QueryString and Web Forms

  • Thread starter Thread starter Arsen Vladimirskiy
  • Start date Start date
A

Arsen Vladimirskiy

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
 
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]
 
Back
Top