This is a migrated thread and some comments may be shown as answers.

[Solved] Column attributes

2 Answers 161 Views
Grid
This is a migrated thread and some comments may be shown as answers.
rtk
Top achievements
Rank 1
rtk asked on 07 Apr 2009, 12:46 PM
Hey.

I'm building my grid programmatic, and in my itembound method i need to do some lookups on spesific columns based on the Id.
So when i create the grid i need to specify which column is a lookup column.

I was hoping i could use attributes, but columns don't have this property.

public static void DefineColumn(string strFile, RadGrid hraGrid)   
{   
   hraGrid.ItemDataBound += new GridItemEventHandler(default_ItemDataBound);   
   
   GridBoundColumn myCol = new GridBoundColumn();   
   hraGrid.MasterTableView.Columns.Add(myCol);   
  
   myCol.attribute["Type"] = "TextLookup";  
  
   myCol.DataField = ;   
   myCol.UniqueName = strBuf;   
   myCol.SortExpression = strBuf;   
  
   GridBoundColumn myCol2 = new GridBoundColumn();   
   hraGrid.MasterTableView.Columns.Add(myCol);   
     
   myCol2.DataField = ;   
   myCol2.UniqueName = strBuf;   
   myCol2.SortExpression = strBuf;          
}   

itembound method
foreach (GridColumn col in e.Item.OwnerTableView.RenderColumns) 
{           
    if (col.type == "TextLookup") 
    {      
      item[0].Text = (string)getText(iTextID); 
    } 

2 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 09 Apr 2009, 09:23 AM
Hi brajoh,

You can store the lookup column's UniqueName in a new variable and use it later for your purposes.

Greetings,
Dimo
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Princy
Top achievements
Rank 2
answered on 09 Apr 2009, 10:53 AM
Hi brajoh,

You may refer the following help article for getting more details about the Column's UniqueName property.
UniqueName Property

Thanks
Princy



Tags
Grid
Asked by
rtk
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Princy
Top achievements
Rank 2
Share this question
or