Click here to Skip to main content
16,021,004 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Can AJAX partial page rendering be applied on a HTML select tag?
If it is suppored, then please provide a sample code.
Posted
Updated 23-Jan-10 10:11am
v3

1 solution

Yes, but I would use the asp:DropDownList control.
XML
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <asp:DropDownList runat="server" ID="DropDownList1" AutoPostBack="true">
            <asp:ListItem>Item 1</asp:ListItem>
            <asp:ListItem>Item 2</asp:ListItem>
        </asp:DropDownList>
        <asp:Label runat="server" ID="Label1" />
    </ContentTemplate>
</asp:UpdatePanel>
C#
protected void Page_Init(object sender, EventArgs e)
{
    this.DropDownList1.SelectedIndexChanged += new EventHandler(DropDownList1_SelectedIndexChange);
}
protected void DropDownList1_SelectedIndexChange(object sender, EventArgs e)
{
    this.Label1.Text = (this.DropDownList1.SelectedItem != null) ? "You selected: " + this.DropDownList1.SelectedItem.Value : "";
}
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900