Clearing checkboxes in a RadGrid

I was working with a Telerik RadGrid control and needed to clear out the CheckBox controls that made up one of the fields of the grid. I had tried to clear the checkboxes in two different places, first in the Button control that fired off a post back, and second, in the Page_Load event. Neither of these worked. Then I came across a post on the Telerik forums that pointed me in the right direction.

My problem wasn’t with the code that cleared the checkboxes, it was with where I was putting that code. The right place to put it was in the ItemCreated event:

public void gridFiles_ItemCreated(object sender, GridItemEventArgs e)
     for (int i = 0; i < gridFiles.Items.Count; i++)
          CheckBox Check = (CheckBox)gridFiles.Items[i].FindControl("cbFile");
          Check.Checked = false;
  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: