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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

get col index from name

Thread ID:





25125 Feb 18,2005 02:45 PM UTC Feb 19,2005 02:11 AM UTC WinForms 2
Tags: GridControl
Joseph Rezuke
Asked On February 18, 2005 02:45 PM UTC

I am using the GridControl. I have initialized the grid by setting the ColStyles for the column headers. Something like this: i = 0; GridStyleInfo gsi = null; foreach meta in GridColMeta { i++; gsi = grid.ColStyles[i]; gsi.Text = meta.ColName; } How do I get the column index based on the meta.ColName;

Administrator [Syncfusion]
Replied On February 18, 2005 04:10 PM UTC

A couple of comments. Not sure whether you are expecting this or not. Setting grid.ColStyles[i].Text does not set the text that is displayed in the column header cell. If you want to set this header cell text, you will need to set grid[0, i].Text. Setting grid.ColStyles[i].Text sets the default text for the column. If that column has any empty cells, you will see the set text in these empty cells. If you want get the index given grid.ColStyles[index].Text, I think you will have to write a method that loops through grid.ColStyles[i].Text looking for the text, and returns the index when you find it. There is nothing in the grid class that would help you do this.

Joseph Rezuke
Replied On February 19, 2005 02:11 AM UTC

Good idea! I will do that.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon