Ok, so I searched the forums and kb and haven't been able to find a good answer yet. I'm sure I just missed it so forgive me! :)
I have a webgrid with a templated column using a checkbox as the control. I want to capture the click event. I've tried to consume the ItemCommand, SelectedCellsChange, ActiveCellsChange event but they aren't working for me. ActiveCellsChange works the first time I click the checkbox but if I click it while it still has focus, the callback doesn't happen. If I place a button control in the template the ItemCommand works but not for a checkbox.
Anyone got some info for me?
Thanks,
Scott
Did u bind the column to the database ??
Thanks!
that's exactly what I ended up doing after trying the CheckedChanged on the templated column. Here's what I did in case anyone has the same problem since I couldn't find exactly what I was looking for in the forums.
I removed the templated column and created a normal grid using the Type="CheckBox" column like this:
<igtbl:UltraGridColumn BaseColumnName="OptionValue" Type="CheckBox" AllowUpdate="Yes" Width="30"> </igtbl:UltraGridColumn>
I then consumed the event UpdateCell and created a method like this:
protected void BackgroundOptions_UpdateCell(object sender, CellEventArgs e) {
//some database update code here }
What I'm trying to do is update immediately (per client specs) any value that they click on a checkbox. Using the above it was very simple to do...
However, I'm having one more problem although I solved it not so elegantly. When I first enter the page containg the grid with checkboxes, although I've databound the grid in the OnLoad event like this:
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!IsPostBack) { BackgroundOptions.DataSource = BackgroundData.getBackgroundOptions(); BackgroundOptions.DataBind(); } }
My grid isn't showing the values in my checkboxes correctly. Since by default they are unchecked, it shows them as unchecked even if the data in the database is of value True. I got around it by consuming the InitializeRow event and updating the checkbox but for some reason (I think because I'm new to the grid and just getting used to it), it seems as if there is another way.
try the cell update event
well, I tried that at first and after reading the documentation it seemed as if there was a "better" way but not finding it, I'm going back to that. Thanks for the info!
Just a hunch: Have you tried designating a CheckBox.OnCheckedChanged handler in your markup?