Finding Template Control in teleRik grid in ItemCreated Event RRS feed

  • Question

  • User1592111484 posted

    Hi to all


                 I have a listbox in TemplateField in a telerik Grid. ListBox is in Item Template. How can i find it in Item Created Event of Grid.

    <telerik:GridTemplateColumn UniqueName="TemplateColumn">
                                        <asp:ListBox ID="ListBox1" runat="server" ></asp:ListBox>



    Varun Anand   

    Tuesday, December 29, 2009 4:02 AM

All replies

  • User-989935113 posted


    You can do this the same as will any templated control:

    var listBox1 = e.Item.FindControl("ListBox1") as ListBox;

    Depending on what type of item each row is though you might need to check first that it isn't a header or footer or edit item.



    Tuesday, December 29, 2009 8:39 PM
  • User-319574463 posted

    If you require more detailed help on Telerik controls, please ask at:


    Friday, January 1, 2010 11:59 AM
  • User417180295 posted


    Try this way

    foreach (GridDataItem row in grvSearch.MasterTableView.Items)

                Label labelPrice = (Label)row["Column Unique Name"].FindControl("Control ID");
                Label lblTotalPrice = (Label)row["Column Unique Name"].FindControl("Control ID");


    Tuesday, May 25, 2010 1:30 AM
  • User1525433465 posted


    Hello Varun,


    Since you have placed the ListBox in ItemTemplate of GridTemplateColumn, you need to check for GridDataItem in order to access the control. Here is the code example.



        protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
            if ((e.Item is GridDataItem))
                GridDataItem dataItem = (GridDataItem)e.Item;
                ListBox listBox1 = (ListBox)dataItem.FindControl("ListBox1");
                // Now you can simply set the properties of ListBox from here
                // listBox1.Visible = false;





    Wednesday, May 26, 2010 2:26 AM