Populate web form with db records

Last post 11-08-2008 5:48 PM by Fashionista007. 5 replies.

Sort Posts:

  • Populate web form with db records

    11-08-2008, 2:53 PM

    I have a web form that lists items from the database and allows the user to edit or delete them. When the user clicks on Edit, they should be taken to another page with the values from the database populated in different controls. I am pretty new to the .NET world and I have seen websites that pass the record id and that somehow populates the page. They use a url like this: www.mywebpage.editnews?!id=41. I was wondering how this is done? Sorry for the noobish question, but I appreciate the help!

  • Re: Populate web form with db records

    11-08-2008, 3:39 PM

    All you need to do is put a <asp:Literal... /> control in your aspx page in the spot where you want to put database data...

    From there you call your database connection and populate the Literal control

    I am using .NET 3.5 and Linq, so mine looks like this

    'Query the database
    Dim _ID As Integer = CInt(Request.QueryString("ID"))
    Dim dc As New DAL.PageDataContext

    Dim results = dc.bt_Page_GetByID(_ID).FirstOrDefault
    Literal1.Text = results.PageContent

    Chase

    Visual Studio 2008
    ASP.NET 3.5 (Visual Basic)
    SQL Server Express

    Check out my blog
  • Re: Populate web form with db records

    11-08-2008, 4:19 PM

    Can you be a little bit more specific? I am using .NET 2.0. I understand how to populate controls on a page but what I need help with is figuring out how to pass the ID of the record from one page to another.

  • Re: Populate web form with db records

    11-08-2008, 5:38 PM
    Hi, search thru forum for "how to pass values through different web pages". Lots of diff ways are there. Then how to retriwe that value eg. How to use Request.QueryString etc. Using this value you can write logic or proc for retrivn data frm db for display.


    Mark as Answer
    on the posts replys that helped you.
    My Blog -: MSChart

  • Re: Populate web form with db records

    11-08-2008, 5:39 PM
    Answer
    Hi, search thru forum for "how to pass values through different web pages". Lots of diff ways are there. Then how to retriwe that value eg. How to use Request.QueryString etc. Using this value you can write logic or proc for retrivn data frm db for display.


    Mark as Answer
    on the posts replys that helped you.
    My Blog -: MSChart

  • Re: Populate web form with db records

    11-08-2008, 5:48 PM

    suthish nair:
    Hi, search thru forum for "how to pass values through different web pages". Lots of diff ways are there. Then how to retriwe that value eg. How to use Request.QueryString etc. Using this value you can write logic or proc for retrivn data frm db for display.

    Thank You! I found my answer in this post:

    http://forums.asp.net/p/1273619/2414687.aspx#2414687

Page 1 of 1 (6 items)