Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > how to check all check boxes in repeater control

Reply
Thread Tools

how to check all check boxes in repeater control

 
 
kris
Guest
Posts: n/a
 
      09-22-2005
Hi All ,

I am using a repeater control to display set of records. Now on the
header template of the Reapeter control there is a Check Box .

For each record that will displayed there will be a check box assigned
to it.

now when i cllick the Check box on the header template all the check
boxes for the record displayed in repeater control have to be checked.

can any one help me in this, can any one provide me a code sample to
how do this.

Thanks

 
Reply With Quote
 
 
 
 
kris
Guest
Posts: n/a
 
      09-22-2005
I fiugured it out how to just do that.Propably if any one are searching
for somethig like this , this would be really helpful


protected void CheckAll(object sender, System.EventArgs e)
{
//sender= above sender in the function, who is sending that one
CheckBox cMain= (CheckBox) sender;//creating a new check box
if(cMain.Checked)//if checked header control
{

foreach(RepeaterItem ri in rpRepeater.Items)//checking all the
repeater items .. one line in rc is a item
if(ri.ItemType== ListItemType.Item)//if that item type is equal to
check box
{
CheckBox cb=(CheckBox) ri.FindControl("cBox");//find control named
cbox whicn is declared in
cb.Checked=true; //HTML
}
}
else// if again checked then de select all
{
foreach(RepeaterItem ri in rpRepeater.Items)
if(ri.ItemType== ListItemType.Item)
{
CheckBox cb=(CheckBox) ri.FindControl("cBox");
cb.Checked=false;
}
}

}
}

Thanks

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Space between input boxes and selection boxes is not the same in Internet Explorer Stefan Mueller HTML 5 06-16-2009 02:06 PM
how to check all check boxes in repeater control kris ASP .Net 0 09-22-2005 06:29 PM
how to check all check boxes in repeater control kris ASP .Net 0 09-22-2005 06:29 PM
Check All Check Boxes pw Javascript 8 05-25-2005 08:14 PM
select all check boxes at a time with check all [Javascript] [Chatakondu Gallery] Suresh Javascript 2 04-22-2004 03:47 PM



Advertisments