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

[Solved] Dropdown list within the item template

2 Answers 174 Views
Grid
This is a migrated thread and some comments may be shown as answers.
naveen veda
Top achievements
Rank 1
naveen veda asked on 19 Aug 2009, 12:54 PM
Hi,
i am using radcontrols for asp.net ajax,

within the radgrid item template i have one drop down list and one label.

i have selected index change event for that dropdown list.

the label should be changed based on the selected item of the drop downlist for each row.

how should i do this?

pls give me the solution.

thanks

2 Answers, 1 is accepted

Sort by
0
Accepted
Daniel
Telerik team
answered on 19 Aug 2009, 01:29 PM
Hello Naveen,

Please try the following approach:
<telerik:GridTemplateColumn> 
    <ItemTemplate> 
        <asp:DropDownList ID="ddl1" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddl1_SelectedIndexChanged"
            <asp:ListItem Text="0" /> 
            <asp:ListItem Text="1" /> 
            <asp:ListItem Text="2" /> 
        </asp:DropDownList> 
        <asp:Label ID="Label1" runat="server" /> 
    </ItemTemplate> 
</telerik:GridTemplateColumn> 

protected void ddl1_SelectedIndexChanged(object sender, EventArgs e) 
    DropDownList ddl = sender as DropDownList; 
    Label label1 = ddl.Parent.FindControl("Label1"as Label; 
    label1.Text = "Selected index: " + ddl.SelectedIndex; 

Regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
naveen veda
Top achievements
Rank 1
answered on 20 Aug 2009, 09:19 AM
Hi Daniel,

thanks for ur reply, its working correctly.
Tags
Grid
Asked by
naveen veda
Top achievements
Rank 1
Answers by
Daniel
Telerik team
naveen veda
Top achievements
Rank 1
Share this question
or