Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1230
In Initialize event, Get Column Index
posted

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??


}
}
Parents
No Data
Reply
  • 20255
    Offline posted

    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>

Children
No Data