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

How to find the ASP Control in Grid

1 Answer 39 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sagar Baheti
Top achievements
Rank 1
Sagar Baheti asked on 18 Sep 2008, 10:17 AM
Hi,
I am using RadGrid, and in CommandItemTemplate i have one asp DropDownList control. but int the SelectedIndexChanged(object sender, EventArgs e) event i am not able to find the that DropDown control. the code is as  follows

<CommandItemTemplate>
        <asp:Label ID="Label1" runat="server" Text="Show Results for Status"></asp:Label>
        <asp:DropDownList ID="ResultStatus_DropDownList" runat="server" OnSelectedIndexChanged="ResultStatus_DropDownList_SelectedIndexChanged" AutoPostBack="true"></asp:DropDownList>

</CommandItemTemplate>
the code behind is as follows

 ResultStatus_DropDownList_SelectedIndexChanged(object sender, EventArgs e)
{
// I tried with GridCommandItem
   GridCommandItem CommandItem = (GridCommandItem)e.GetType();
            DropDownList ResultStatus_DropDownList = (DropDownList)CommandItem.FindControl("ResultStatus_DropDownList");

//  But not able to find the ResultStatus_DropDownList control.
}
So please help

Regards,
Sagar






1 Answer, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 18 Sep 2008, 10:28 AM
Hello Sagar,

In this case DropDownList is the sender argument. All you need is to cast sender to DropDownList.

Greetings,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Sagar Baheti
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or