QueryString and Web Forms

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
 
R

Rob Teixeira [MVP]

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]
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,042
Latest member
icassiem

Latest Threads

Top