Hello
I have an OnRowCreated event in my RadGrid. I need to add a onclick event depending on what column it is for each cell. Instead of using (i == #) in my loop to determine the onclick event (because the column index numbers change depending on the data being loaded), I would like to find out the column unique name (elementName in the code below) for that cell and use that as the determinant for the onclick event. But so far, I have not found out how to obtain the unique name for the column.
Thanks
Oscar
I have an OnRowCreated event in my RadGrid. I need to add a onclick event depending on what column it is for each cell. Instead of using (i == #) in my loop to determine the onclick event (because the column index numbers change depending on the data being loaded), I would like to find out the column unique name (elementName in the code below) for that cell and use that as the determinant for the onclick event. But so far, I have not found out how to obtain the unique name for the column.
Thanks
Oscar
| function RowCreated(sender, eventArgs) { |
| var dataItem = eventArgs.get_gridDataItem(); |
| for (var i = 0; i < dataItem.get_element().cells.length; i++) { |
| //if (elementName == 'CompName') { |
| if (i == 1) { |
| dataItem.get_element().cells[i].onclick = function() { |
| this.selected = this.selected == true ? false : true; |
| //some function |
| }; |
| } |
| else if (i == 2) { |
| dataItem.get_element().cells[i].onclick = function() { |
| this.selected = this.selected == true ? false : true; |
| //some function |
| }; |
| } |
| else if (i == 3) { |
| dataItem.get_element().cells[i].onclick = function() { |
| this.selected = this.selected == true ? false : true; |
| //some function |
| }; |
| } |
| } |
| } |