How to use Dropdown extender control in Ajax?

aswinialuri-19361
Posted by aswinialuri-19361 under ASP.NET AJAX category on | Points: 40 | Views : 10968
aspx code:
<body>
<form id="form1" runat="server">
<div>
<h1 align="center" style="color:Teal">Ajax Control Toolkit Example: How To Use DropDownExtender</h1>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:Label
ID="Label1"
runat="server"
ForeColor="Yellow"
Font-Bold="true"
Font-Names="Courier New"
Font-Size="Large">
</asp:Label>
<br />
<asp:Panel ID="Panel1" runat="server">
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
onselectedindexchanged="DropDownList1_SelectedIndexChanged">
<asp:ListItem>seagreen</asp:ListItem>
<asp:ListItem>red</asp:ListItem>
<asp:ListItem>pink</asp:ListItem>
<asp:ListItem>orange</asp:ListItem>
</asp:DropDownList>
<asp:DropDownExtender ID="DropDownExtender1" runat="server" DynamicServicePath="" Enabled="True" TargetControlID="DropDownList1">
</asp:DropDownExtender>
</asp:Panel>
</div>
</form>
</body>

In .aspx.cs code:
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
Label1.Visible = true;
Label1.Text = "You clicked: " + DropDownList1.SelectedItem.ToString();
}

I Hope it will help you

Comments or Responses

Login to post response