QueryString and Web Forms

Discussion in 'ASP .Net' started by Arsen Vladimirskiy, Dec 16, 2003.

  1. Hello,

    I have a few web forms:

    1) Shows a list of items with item ids
    2) Shows details specific to an item and the sub-items of this item.

    What is the best way to pass the item id of the selected item from the 1st
    page to the 2nd?

    If I pass the value in the query string from the first 1st form to the 2nd,
    the 2nd form's URL will always contain that it in it since ASP.NET uses POST
    method and not a get method. So if on the 2nd form there is a way to pick a
    different item from a drop-down list, the URL will still contain the id of
    the orginally selected item, while the details will be shown for the item
    that was subsequently selected from the drop-down. This does not look right.

    Should I use the Session() to pass the item id of the selected item from the
    1st to 2nd page instead of the QueryString method?

    Thanks,
    Arsen
    Arsen Vladimirskiy, Dec 16, 2003
    #1
    1. Advertising

  2. ASP.NET uses POST instead of GET for posting control data, but that is NOT
    why your value appears on the URL.
    QueryStrings ALWAYS appears in the URL (in any language on any CGI-type web
    platform).
    If your controls have proper IDs assigned you can use Request.Forms on the
    second page to get the form control values from the page that just posted.

    -Rob Teixeira [MVP]

    "Arsen Vladimirskiy" <> wrote in message
    news:%23nNkxa$...
    > Hello,
    >
    > I have a few web forms:
    >
    > 1) Shows a list of items with item ids
    > 2) Shows details specific to an item and the sub-items of this item.
    >
    > What is the best way to pass the item id of the selected item from the 1st
    > page to the 2nd?
    >
    > If I pass the value in the query string from the first 1st form to the

    2nd,
    > the 2nd form's URL will always contain that it in it since ASP.NET uses

    POST
    > method and not a get method. So if on the 2nd form there is a way to pick

    a
    > different item from a drop-down list, the URL will still contain the id of
    > the orginally selected item, while the details will be shown for the item
    > that was subsequently selected from the drop-down. This does not look

    right.
    >
    > Should I use the Session() to pass the item id of the selected item from

    the
    > 1st to 2nd page instead of the QueryString method?
    >
    > Thanks,
    > Arsen
    >
    >
    Rob Teixeira [MVP], Dec 16, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Derrick
    Replies:
    6
    Views:
    3,996
    navyjax2
    Nov 28, 2011
  2. Mehdi
    Replies:
    6
    Views:
    36,109
    sloan
    Apr 6, 2006
  3. Replies:
    2
    Views:
    1,681
    ytkaczyk
    Aug 20, 2008
  4. Eric
    Replies:
    2
    Views:
    504
  5. Adeel Ahmad
    Replies:
    1
    Views:
    461
    Anthony Jones
    Mar 7, 2006
Loading...

Share This Page