Hay Can some one do me favour:'(
I need complete code for Check/Uncheck all items in checkboxlist using asp.net in serverside.
I kept one checkboxlist and bound data source to it in runtime and using two linkbutton to check or uncheck items in checkboxlist.i need to reterive data from selected checkboxlist.
i want this in server side code not by javascript.
I tried this code in linkbutton click event but no hope.

foreach(ListItem item in checkboxlist1.Items)
{
item.selected=true;
}

but no hope:icon_cry: pls some one help me......

Recommended Answers

All 6 Replies

Code looks ok, is the checkboxlist inside another control - i.e. a gridview or detailsview or something?

Are you sure that u r not doing any other mistake & you have data there in Checkbox list..? As your code is correct & it should work.I tried it in my application & it is working fine.Try to debug & put the breakpoints on Linkbutton's Click event, see what's the problem.

Hay Can some one do me favour:'(
I need complete code for Check/Uncheck all items in checkboxlist using asp.net in serverside.
I kept one checkboxlist and bound data source to it in runtime and using two linkbutton to check or uncheck items in checkboxlist.i need to reterive data from selected checkboxlist.
i want this in server side code not by javascript.
I tried this code in linkbutton click event but no hope.
foreach(ListItem item in checkboxlist1.Items)
{
item.selected=true;
}
but no hope:icon_cry: pls some one help me......

I used it inside a asp.net panel pls help me..:icon_cry:

i think the code should work.are you binding data to checkbox again after that foreach statement anywhere...?

I tried no use. Pls some one post me the coding.... I kept the checkboxlist inside a panel. And tried to check all items in runtime server side coding through linkbutton... But its not working

Post your code so we can see what the problem is.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.