Click here to Skip to main content
15,609,864 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In CheckBoxList pass multiple values from one page to another page...

you can use session for this
In first page set session
// Create the list to store.
        List<string> StrList = new List<string>();
        // Loop through each item.
        foreach (ListItem item in ChkBox.Items)
            if (item.Selected)
                // If the item is selected, add the value to the list.
// Now set session 
session["selectedStrList"] = StrList;
//Redirect to other page
Response.Redirect("...", false);

then recieve list from session in second page's page load event
    List<string> StrList = new List<string>();
    if ( session["selectedStrList"] != null) //confirm session is not null
         StrList = (List<string>)session["selectedStrList"]; //cast session object to list of string

Happy Coding!
Share this answer
Gokul Athithan 30-Dec-13 6:53am    
I am getting this error when i write this code
if (!IsPostBack)
List<string> strlist=new List<string>();
Cannot implicitly convert type 'object' to 'System.Collections.Generic.List<string>'. An explicit conversion exists (are you missing a cast?)
Aarti Meswania 30-Dec-13 7:22am    
I have updated solution
please check again
hope this will work perfectly as your requirement :)
Gokul Athithan 30-Dec-13 7:49am    
Thank You...
Aarti Meswania 30-Dec-13 8:19am    
Glad to help you! :)
you have create one hidden field then create array and when any checkbox is cheked then push it to in array when form submit then array strore in hidden field and pass to another page
Share this answer
You need to ask specific question with details to get help. It's not possible to know exactly what you are trying to do.

Anyway, this is the ASP (server side) control you are using. The values get passed to the next page on form submit, without you doing anything.
for this control

<asp:CheckBoxList ID="CheckBoxList1" runat="server" ClientIDMode="Static">
            <asp:ListItem Text="1" Value="1" />
            <asp:ListItem Text="2" Value="2" />

Just access them as

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