How can we get column index in initialize event?
function dgvLResults_Grid_Initialize(grid, eventArgs) { for(int i=0;i<grid.get_rows().get_length();i++) { var row=grid.get_rows().get_row(i); var col=row.get_cellByColumnKey("Temp"); ---How can I find the col index of this column?? } }
Hello Birendra,
Thank you for your question.
Yes, it is possible to get the column index of this cell (despite the variable name, the return object is a column cell).
You can simply call, get_column().get_index().
Have a look at the code snippet below:
<script type="text/javascript" id="igClientScript1"> function WebDataGrid1_Init(sender, eventArgs) {
for (var i = 0; i < sender.get_rows().get_length() ; i++) { var row = sender.get_rows().get_row(i); var col = row.get_cellByColumnKey("RequiredDate"); var index = col.get_column().get_index(); debugger; } }</script>