checkbox in datalist

G

Guest

I have a datalist with checkboxes and what I want to do is, to allow the user
select the check box(s) and click a button. When the click the button i want
it to only show the items selected. Either open a new page with the selected
items or hide the items not checked. Has anyone done this or can anyone point
me to somewhere that shows this or something like this?
thx
 
M

Martin Dechev

Try this:

protected void button1_Click(object s, EventArgs e)
{
int i = 0;
while(i < checkBoxList1.Items.Count)
{
if(!checkBoxList1.Items.Selected)
{
checkBoxList1.Items.RemoveAt(i);
continue;
}
i++;
}
}

Greetings
Martin
 

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,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top