Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
525
how to access Template column control at run time
posted

Hi ,

I am using Infragistics V8.2

How to access Template column at runt time? 

<igtbl:TemplatedColumn Width="145px">

<CellTemplate>

 

<asp:LinkButton ID="linkview" runat="server" Text="View" CommandName="View" CommandArgument='<%# Eval("ID") %>'></asp:LinkButton>

<Footer><RowLayoutColumnInfo OriginX="1" /></Footer>

 

</igtbl:TemplatedColumn>

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

Parents
No Data
Reply
  • 811
    Suggested Answer
    posted

    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 Item
    LinkButton lnBttn = ((LinkButton)(item.FindControl("linkview")));      
    }

    Hope it helps you. Thank you.

    Bunty   :)

Children
No Data