We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to find ColumnIndex knowing ColumnName

What is the best way to find current column index having column name? I was hoping to find it inside GridDataStyleInfo.CellIdentity.Column property, but it seems to be null most of the time. 

 


1 Reply

SM Saravanan M Syncfusion Team February 24, 2014 06:13 AM UTC

 

Hi Vaban,

 We are sorry for delay caused,

 We have analyzed your query. You can find the column index by knowing the column name. You need to call IndexOf method to find the Visible Column index. Please refer the below code snippet.

 Code snippet[C#]:

private void Button_Click(object sender, RoutedEventArgs e)

{

 var column=this.syncgrid.VisibleColumns["ProductName"];

 int index = this.syncgrid.VisibleColumns.IndexOf(column);

}

 

We have prepared the sample based on your requirement and you can download it from below attachment. 

Please let us know if this sample helps you ,


Regards,

Saravanan.M

 


Attachment: GDC_Sample_ColumnIndex_c147e96e.zip

Loader.
Up arrow icon