Click here to Skip to main content
15,913,773 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My scenario is user will select multiple check box and i need to store all the ids(for the select checkbox).Now user will hit a particular button where he will be redirected to another page.Now in that page i need to use the ids .This ids actually matches to a document id and using these ids i need to implement a pager which display all those documents having ids selected by user.


It's bite complicated but any useful information will be appreciated.I need a best way to achieve this. I am trying to avoid sections and cookies for doing the same.
Posted

You can use a form having an action attribute with these check boxes. That way, when you will submit the form, all of the data of this form would be sent to the next page where you can manipulate the data and show related content to the user. For example the following form,

HTML
<form method="post" action="second_page.aspx">
   <!-- Form elements here... -->
</form>


Now when user will submit it, it would be redirected (automatically) to the second page and would have the data present there. You can access the data as,

C#
var val = Request["input-name"];


There are others methods of doing the same thing. Which includes, Session variables can be a good replacement for this if you want to perform a manual redirect or something like that. Secondly, if you want to store these values on the client-side, then you can use localStorage or sessionStorage too (Read storage API on MDN[^]). They also provide a vital replacement for form values, if you don't want to use a form and so on. Please read this article of mine, which covers the similar topic "How to share data among different web pages using ASP.NET[^]".
 
Share this answer
 
 
Share this answer
 
Comments
Member 11364465 31-Mar-15 4:39am    
ViewData,ViewBag,TempData woul not help in this case.As i have to ids of selected checkbox and used it another on page where i ll redirect to other action also.Session will work but we are required not to use sessions.

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