Hello,
I'm using VS2010 with 10.3 release. I have a webdatagrid with a template and a checkbox inside. I set the onclick event for the checkbox but it never fires. I tried to catch the cellvalue changing event and check for the column key but that didn't work either.
How can I have a client side event for the checkbox to perform some validation on it if it's checked/unchecked. I want to be able to check it only if another cell was edited and has values in it. If it doesn't then cancel or return flase and the check is cleared.
here's my checkbox code:
<ItemTemplate> div style="text-align: center;"> asp:CheckBox ID="CheckSpecific" runat="server" AutoPostBack="true" Checked='<%# Bind("IsSpecific") %>' OnCheckedChanged="CheckSpecific_CheckedChanged" /> div> ItemTemplate>
Thanks,
Hello marcgh,
Have you been able to resolve your issue ?
If you still have any concerns or questions I will be glad to help.
Best Regards,
Maya Kirova
Developer Support Engineer
Infragistics, Inc.
http://ko.infragistics.com/support
Your solution seems reasonable and I can’t think of a different approach right now. Go ahead and use it.
If you need further help with this don’t hesitate to ask.
Ok the way I did was is:
On row Initialize I find the checkbox and add the attributes to it:
var check = e.Row.Items[14].FindControl("CheckSpecific") as CheckBox;checkbox.Attributes.Add("onclick", "return CheckSpecific('" + recordId + "');");The record id is from: var recordId = ((MyObject) e.Row.DataItem).RecordId;
In the javascript method, i looped thru all rows to find the row with the same ID then add the logic I needed:
function CheckSpecificTaxLot(rowId) { var grid = $find('<%= wdg.ClientID %>'); var gridRows = grid.get_rows(); var length = gridRows.get_length(); for (var i = 0; i < length; i++) { row = gridRows.get_row(i); var id = row.get_cellByColumnKey("RecordId").get_value(); if (id == rowId) { // logic here ... // ... return (..boolean ..) ? false : true; } } return false;}
Is this is the way to do or maybe there is a more efficient way?
I was able to add the client side event to the checkbox but how can i pass the checkbox object to the javascript method?
or how can I figure out which row the checkbox was clicked on. I need to check another column on that row if it has any value then enable the check or disable it !! so i need access to the row object.
Hello Maya,
Thank you for your help. We did upgrade to the latest release 11.1 but I did not like how the BoundCheckBox field was implemented. It's not implemented as a true checkbox it's an image that gets changed every time the user clicks on the cell. It does not provide an enable or disable feature. We had to go back to 10.3 since that did not fit what we wanted.