Accessing controls in GroupTemplate

2 posts, 1 answers
  1. Barbaros Saglamtimur
    Barbaros Saglamtimur avatar
    110 posts
    Member since:
    Jul 2012

    Posted 13 Oct 2011 Link to this post

    I need to access controls in GroupTemplate when ever a new group is created.
    Is that possible?
  2. Answer
    Andrey
    Admin
    Andrey avatar
    836 posts

    Posted 18 Oct 2011 Link to this post

    Hello Barbaros,

    You could access the controls in GroupTemplate with the approach described here. You only need to change the type of the item in the if statement. So after the modification, your code should look like this:

    protected void RadListView1_ItemCreated(object sender, Telerik.Web.UI.RadListViewItemEventArgs e)
        {
            if (e.Item is RadListViewGroupItem)
            {
                RadListViewGroupItem item = e.Item as RadListViewGroupItem;
                TextBox txtBox = item.FindControl("TextBox1") as TextBox;
            }
        }

    In this example I have assumed that the ID of the RadListView instance is "RadListView1", the ID of the TextBox is "TextBox1" and the type of the control in GroupTemplate is TextBox. You should change these to match your naming convention.

    All the best,
    Andrey
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top