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
570
ultrawebgrid's TemplatedColumn
posted

How can I find asp.net's control where it is in ultrawebgrid's TemplatedColumn when I worked C# code.

sample:

<igtbl:TemplatedColumn>

    <CellTemplate>

       <asp:Label ID="lbl" runat="server" Text="Label"/>

    </CellTemplate>

</igtbl:TemplatedColumn>

Parents
No Data
Reply
  • 2907
    Verified Answer
    posted

    Hi,

     

    You can find controls from TemplateColumn at row level. You could refer following code for detail

     

    You need to use following type of markup in aspx file.

     

    <igtbl:TemplatedColumn Key="Col1" >

    <CellTemplate>

    <asp:Image ID="imgCol1" runat="server" />

    <asp:Label ID="lblCol1" runat="server" />

    </CellTemplate>

    </igtbl:TemplatedColumn>

     

    To access above controls you can use following C# code.

     

    protected void grid1_InitializeRow(object sender, RowEventArgs e)

        {

            TemplatedColumn col1 = (TemplatedColumn)e.Row.Cells.FromKey("Col1").Column;

            CellItem cellItemCol1 = (CellItem)col1.CellItems[e.Row.Index];

            Image imgCol1 = (Image)cellItemCol1.FindControl("imgCol1");

            Label lblCol1 = (Label)cellItemCol1.FindControl("lblCol1");

        }

     

    In above code imgCol1 and lblCol1 will be controls inside template column keyed as Col1 for particular row.

     

    Let me know if this helps you.

Children