Visual Studio .NET - Radgrid column name - Asked By f n on 24-Sep-08 02:40 AM

how to get column name in radgrid by click cell content?

RE - Web Star replied to f n on 24-Sep-08 03:12 AM

In various cases you may want to access grid functional items/columns outside of the grid server event handlers. This is easily attainable with the GetItems(itemType), GetColumn(columnName) and GetColumnSafe(columnName) methods (exposed by each GridTableView instance). 

The GetItems(itemType) method returns an array of items (in the respective GridTableView) which match the specified type. You can use the GridItemType enumeration to choose the item type, for example

Dim headerItem As GridItem = RadGrid1.MasterTableView.GetItems(GridItemType.Header)(0)
'cast the item to GridHeaderItem and operate with it further

http://www.telerik.com/help/aspnet/grid/grdusinggetitemsgetcolumnmethods.html

See this - Kalit Sikka replied to f n on 24-Sep-08 05:17 AM

protected void RadGrid1_ColumnCreated(object sender, Telerik.WebControls.GridColumnCreatedEventArgs e)
{
//code goes here
}
To set this ordering value for each field we will initialize a string array called fieldOrder in the following manner where we will be using the index of the field in the array to be the value of the OrderIndex property.


string[] fieldOrder = new string[] { "ID","Name","FirstName","LastName","MiddleName","Age" };


Now we can set the OrderIndex property of the GridColumn.


e.Column.OrderIndex = Array.IndexOf(fields, e.Column.HeaderText);