We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How can I on server side clear all check boxes.

How can I on server side clear all check boxes.
In check box template column which was created with the help of .


1 Reply

MW Melba Winshia Syncfusion Team August 21, 2007 11:04 AM UTC

Hi,

I apologize for the delay in responding.

If your intention is to clear all check boxes in server side, it can be achieved by using the OnCheckedChanged event.

[C#]

protected void cbRowBtnTemplate_CheckedChanged(object sender, System.EventArgs e)
{
CheckBox checkbox = (CheckBox)sender;
GridRow gridrow = (GridRow)checkbox.Parent.Parent;
string identifyHeader = gridrow.DisplayElement.Info;
int indexOfHeader = identifyHeader.IndexOf(")") - identifyHeader.IndexOf("(") + 1;
string rowType = identifyHeader.Substring(identifyHeader.IndexOf("("), indexOfHeader);
if (rowType != "(GridColumnHeaderSection)")
{
string categoryName = gridrow.Record.GetValue("CategoryName").ToString();
if (checkbox != null)
{
if (checkbox.Checked == true)
{
lstSelectedProducts.Items.Add(categoryName);

}
else
{
lstSelectedProducts.Items.Remove(categoryName);
}
}
}
else
{
if (checkbox.Checked == false)
ClearListBox();
}

}


Please refer the sample in the below link which illustrates the above.

http://websamples.syncfusion.com/samples/Grouping.Web/5.1.1.0/66962_1/main.htm

In the above sample if you check the checkbox in header CategoryID all check boxes will be checked and if you clear the checkbox in the header, then all check boxes will be unchecked. If I have misunderstood your requirement, could you please explain me in detail, so that I can work in depth and try to send a better solution?

Thanks,
Melba

Loader.
Live Chat Icon For mobile
Up arrow icon