WebDataGrid- Handling CheckBoxes
New DiscussionHi,
I use the below JS method to set a specific cell on a column+ row as readonly/ editable
function WebDataGrid1_CellEditing_EnteringEditMode(grid, eventArgs)
{
var cell = eventArgs.getCell();
var index = cell.get_row().get_index();
var key = cell.get_column().get_key();
if (index == "2" && key == "FIRSTNAME") // ReadOnly
{
eventArgs.set_cancel(true);
}
if(index == "0" && key == "LASTNAME") // Editable
{
eventArgs.set_cancel(false);
}
}
Then i set a value to a specific cell (based upon certain conditions at server side) using the server side logic
grdDataTable.Rows(rowIndex).Items(columnIndex).Text = “Hello”
However, i am facing issues with checkboxes when dealing with these two cases.
The check box is automatically shown in the grid as the dynamic data bound from the datasource is of type boolean.
1. How to Disable Checkbox(ie Not make it clickable) using the WebDataGrid1_CellEditing_EnteringEditMode JS method,
if there is a checkbox inside the cell where the // ReadOnly condition is satisified.?
2. How to Set CheckBox enabled/disabled using the server side logic that i mentioned above? I tried setting the
grdDataTable.Rows(rowIndex).Items(columnIndex).Value = false/ true (For CheckBox types) but it is throwing an exception
3. If we are to disable editing an entire column using server side logic, How to disable all the checboxes from that column?
Web Page Code: (Please note that i dynamically bind data to the grid)
Thanks,
Aravind