This is a migrated thread and some comments may be shown as answers.

Accessing controls in GroupTemplate

1 Answer 73 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Barbaros Saglamtimur
Top achievements
Rank 1
Barbaros Saglamtimur asked on 13 Oct 2011, 02:11 PM
I need to access controls in GroupTemplate when ever a new group is created.
Is that possible?

1 Answer, 1 is accepted

Sort by
0
Accepted
Andrey
Telerik team
answered on 18 Oct 2011, 12:02 PM
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
Tags
ListView
Asked by
Barbaros Saglamtimur
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Share this question
or