Results 1 to 6 of 6

Thread: [2008] Sending form data and more

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2008
    Posts
    5

    [2008] Sending form data and more

    I have installed Visual Studio 2008 recently and planned to use it for a project for school, I previously used Visual Studio 2003 but that was 2 years ago, I really have no idea about much in it.. anywhoo
    I have to do a website, and its auto parts, I'm trying to do a reservation page at them moment, and I want the form data to send to the database

    normally I know with 03 my code would look something like
    Code:
    Dim M As DataRow = Datasetname.TableName.NewRow
                M("CustomerName") = txtName.Text
                M("Email") = txtEmail.Text
                M("CustomerNo") = txtPhone.Text
                M("PartNo") = txtPart.Text
                M("Date") = lblDate.Text
                M("HeldUntil") = lblheld.Text
                Dataset.Table.Rows.Add(workrow)
                DataAdapter.Update(Dataset)
    The thing is I don't know if I'm connecting it properly, because in '03 after I made the connection I could have just right-clicked the connection and generate the dataset. The controls here are different, theres an AccessDataSource which I assume would be my data adapter, but I don't know how to generate the dataset from it or, I don't know if I'm correct in my wording of this, associating the dataset with that connection?

    I have no idea how to work it with '08 can somebody please help me?

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [2008] Sending form data and more

    In VS2008 (.NET 3.5/ASP.NET 2.0) you can still continue using the code you used before - a dataadapter, a dataset, etc.

    You also have the option of *datasource controls - SqlDataSource, AccessDataSource, ObjectDataSource, which do all the data population for you, and the binding when you specify it as the datasource for a control.

    However, that's just an overview, you really need to search for examples on MSDN to see how these things work. Or look for a tutorial.

  3. #3

    Thread Starter
    New Member
    Join Date
    Sep 2008
    Posts
    5

    Re: [2008] Sending form data and more

    Ok, so heres where the "and more" comes in,
    I couldn't do it there so I just went back to '03 and everything went fine..
    Well anyhoo, in the website I have a page, that lists the contents of one of the tables in my database in the form of a datagrid.
    Instead of building like 200 pages for each item and putting each link in a hyperlink field on the datagrid, is there any way for me to just build one page
    and transfer the values of a selected row into that one page accordingly??

    I may be thinking about it in the wrong way because I needed some way to have a search of sorts on the items in the table, so I used dropdownlists and used the selected values from them to sort of filter the items in the table. The main point is to link each item to a page with their data after they have been filtered.

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [2008] Sending form data and more

    Yes, it is simple to do what you're asking for. Your gridview can have an extra hyperlink or template column which you populate with hyperlinks. The hyperlinks all point to, for example,

    ShowDetails.aspx?itemid=xxxx


    Where xxxx is the ID of the item you want to show. ShowDetails.aspx in turn, on pageload, looks at the itemid value and loads the corresponding data for that item.

  5. #5

    Thread Starter
    New Member
    Join Date
    Sep 2008
    Posts
    5

    Re: [2008] Sending form data and more

    Hello, thank you for your reply to my post. I think its a great idea and would help me alot, at least to make the website alot more user friendly. This is the last part of my website that I have to figure out, the problem is I don't know how to work the querystrings.

    Before you suggested it, i.e. putting the link entries into my database as "products.aspx?itemid=xxxx"
    I had resorted to putting a textbox that users could enter the part number manually to match the one that showed up in the datagrid, and then on the products.aspx page load it would get the information from the database to match the part number that was entered.

    The problem is I don't know how to work the querystring in the url. When the page redirects, how do I pull the value from the url so I can put it to use?
    How do I get the value from the url or the url in general so that I can assign it to a variable for use in my query of the databse.

    I have looked up the querystrings online, but I see alot of code in SQL which I am unfamiliar with, so is there a way to get the value using VB code?

    Thanks Again,
    Gareth

  6. #6
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [2008] Sending form data and more

    To read the querystring parameter from the URL,

    vb Code:
    1. Dim currentItemID As String
    2. currentItemID = Request.QueryString("itemid")
    3. If Not String.IsNullOrEmpty(currentItemID) Then
    4. 'Load your data
    5. End If

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width