Click here to Skip to main content
16,019,764 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
my requirement is that

how to handle querystring in Multiple pages asp.net

mydemo.com\home.aspx?id=1
mydemo.com\contact-us.aspx?id=1
mydemo.com\projects.aspx?id=1


and This ID Values is dynamic ...
Posted
Updated 18-Jul-12 21:42pm
v2
Comments
MAU787 19-Jul-12 3:26am    
r u calling all pages on single button?? not getting ur question
MAU787 19-Jul-12 3:28am    
u can use session variable if you want to maintain id at each page
sandeep nagabhairava 19-Jul-12 3:51am    
I agree with you MAU787.
hi anil, if you have more pages then you can go for session instead of querysting..

Handling querystring for one page is same for any page.

QueryString is a page level state management technique. Once you are on a particular page, you can access the query string using Request.QueryString

Read about querystring here: Passing variables between pages using QueryString[^]
 
Share this answer
 
Each page, you need to write the code to handle the query string for that page. In fact, each page gets compiled and created during a request, the other pages do not even exist in memory. You CAN create a base page class that somehow interpets a query string value the same way, and you can also create a static string class to strongly type the query string value ( id in this case ), but each page will be responsible for responding to the query string in a way that interacts with it's controls. The only other way to centralise dealing with the value, is using a master page that does so.

Also, you have not told us what this query string value even does.
 
Share this answer
 
I think you want to pass query string parameter for different pages then pass page type with it and check for that id for the specific page in the requested page. you can also use eval("EmpId") function to bind id for the link.

Thanks
Nayan Chavada
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900