When I was using a GridClientSelectColumn to select rows in my RadGrid, I used this post and this post to persist the checked state on the client side, using JavaScript to store the selected row ids in a hidden field.
I'd like to do this with checkboxes that are GridTemplateColumns defined on the server side, like this:
I think I can do the same kind of thing here, except I can no longer call the JavaScript function RadGrid1_RowSelected since I'm not selecting the row, just checking boxes. I'll need to use another event that fires when a checkbox is checked or unchecked (I guess that's CheckChanged). But how do I add a handler on the server side and have it handled on the client side?
I'd like to do this with checkboxes that are GridTemplateColumns defined on the server side, like this:
foreach (blah blah) { templateColumn = new GridTemplateColumn(); RadGrid1.MasterTableView.Columns.Add(templateColumn); templateColumn.ItemTemplate = new MyTemplate(blah); templateColumn.HeaderText = blah; }private class MyTemplate : ITemplate{ protected CheckBox chk; private string columnName; public MyTemplate(string columnName) { this.columnName = columnName; } public void InstantiateIn(Control container) { chk = new CheckBox(); chk.ID = "chk" + columnName; chk.DataBinding += new EventHandler(DataBinding); chk.Enabled = true; container.Controls.Add(chk); } void DataBinding(object sender, EventArgs e) { CheckBox cBox = (CheckBox)sender; GridDataItem container = (GridDataItem)cBox.NamingContainer; cBox.Checked = (bool)((DataRowView)container.DataItem)[columnName]; }}I think I can do the same kind of thing here, except I can no longer call the JavaScript function RadGrid1_RowSelected since I'm not selecting the row, just checking boxes. I'll need to use another event that fires when a checkbox is checked or unchecked (I guess that's CheckChanged). But how do I add a handler on the server side and have it handled on the client side?