Click here to Skip to main content
15,904,156 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
/*aspx page*/

ASP.NET
<asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server">
          <contenttemplate>
              <asp:Label ID="Label1" runat="server" Text="">

 <asp:DropDownList ID="drpSecret" runat="server" Height="16px"
          onselectedindexchanged="drpSecret_SelectedIndexChanged" Width="213px"
             AutoPostBack="True" >
          <asp:ListItem>1
          <asp:ListItem>2
     
          </contenttemplate>
          <triggers>
                <asp:AsyncPostBackTrigger ControlID="drpSecret"
                    EventName="SelectedIndexChanged" />
          </triggers>





/*code behind*/
C#
protected void drpSecret_SelectedIndexChanged(object sender, EventArgs e)
        {
            Label1.Text = drpSecret.SelectedItem.Text;
        }
Posted
Updated 10-Jun-12 21:25pm
v2

1 solution

Use below code. I think this will solve your problem.

C#
<asp:updatepanel id="UpdatePanel1" updatemode="Conditional" xmlns:asp="#unknown">
                             runat="server">
                <triggers>
                  <asp:asyncpostbacktrigger controlid="drpSecret" eventname="SelectedIndexChanged" />
                </triggers>
                <contenttemplate>
                <asp:dropdownlist id="drpSecret" runat="server" height="16px" onselectedindexchanged="drpSecret_SelectedIndexChanged" width="213px">
AutoPostBack="True" >
<asp:listitem>1
<asp:listitem>2
                </asp:listitem></asp:listitem></asp:dropdownlist></contenttemplate>
            </asp:updatepanel>


For more info see:
http://msdn.microsoft.com/en-us/library/system.web.ui.asyncpostbacktrigger.aspx
Thanks,
Rahul Sharma
 
Share this answer
 

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