Hi ,
I am using Infragistics V8.2
How to access Template column at runt time?
<igtbl:TemplatedColumn Width="145px">
<CellTemplate>
<Footer><RowLayoutColumnInfo OriginX="1" /></Footer>
I want to access the above link button at run time when ever grid will bind and i need to add some attributes to that link button?
How to access Template column control at run time?
Regards
Sivaprasad
Sivaprasad,You can access the template column by using on InitializeRow event: protected void UltraWebGrid1_InitializeRow(object sender, Infragistics.WebUI.UltraWebGrid.RowEventArgs e) { //Accessing the Template Column Named: [MyTemplateCol] Infragistics.WebUI.UltraWebGrid.TemplatedColumn col = (Infragistics.WebUI.UltraWebGrid.TemplatedColumn)UltraWebGrid1.Columns.FromKey("MyTemplateCol"); Infragistics.WebUI.UltraWebGrid.CellItem item = (Infragistics.WebUI.UltraWebGrid.CellItem)col.CellItems[e.Row.Index]; //this will provide you with the object of Link button in the Template column LinkButton lnBtn = (LinkButton)item.FindControl("linkview"); }and if you want to access the template column on the button click then you should go for the following code snippet:protected void Button1_Click(object sender, EventArgs e){//access the template column Infragistics.WebUI.UltraWebGrid.TemplatedColumn col = ((Infragistics.WebUI.UltraWebGrid.TemplatedColumn)(UltraWebGrid1.Columns.FromKey("MyTemplateCol")));Infragistics.WebUI.UltraWebGrid.CellItem item = ((Infragistics.WebUI.UltraWebGrid.CellItem)(col.CellItems[0]));//taking object of template ItemLinkButton lnBttn = ((LinkButton)(item.FindControl("linkview"))); }
Hope it helps you. Thank you.
Bunty :)