Click here to Skip to main content
14,454,632 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi all,
i have a issue with update panel button click event.
I have a master page called Test.Master which have a update panel and a place holder in side the update panel. and two content placeholders which are out side the update panels.
now i have a webpage called Test.aspx which have a menu control and one update panel with one place holder. for this at server side based upon the selected menu item i am loading different different user controls in that. for example: if i click menuitem1 it need to load with test1.ascx and if i clicks on menuitem2 it need to load with test2.ascx. here in test2.ascx i have three textboxes and one button to submit the values to now the problem is i click on the button the button click event is not get fire.

it fires when i submit 2nd time. can any one please help me to solve this.

here is my code:
<div id="menu" class="menupanel" style="display:none;width: 800px;" align="center">
                <asp:ContentPlaceHolder ID="menupanel"  runat="server">        
         <asp:UpdatePanel ID="UpdatePanel3" runat="server"  UpdateMode="Conditional"   ChildrenAsTriggers="true"  >
               <asp:PlaceHolder  ID="PlaceHolder1" runat="server">
            <div id="removed" class="removedpanel" style="display:none;width: 800px;" align="center">
                 <asp:ContentPlaceHolder  ID="ContentPlaceHolder1" runat="server">

code from Test.aspx:
<asp:UpdatePanel ID="UpdatePanel3" runat="server"  UpdateMode="Conditional"   ChildrenAsTriggers="true"  >
             <asp:PlaceHolder  ID="PlaceHolder1" runat="server">

code from Test1.ascx:
<asp:UpdatePanel ID="UpdatePanel3" runat="server"  UpdateMode="Conditional"   ChildrenAsTriggers="true" >

                <asp:Label ID="lblOpwd" runat="server" Text="Old Password"></asp:Label>

                <asp:textbox ID="txtOpwd" runat="server" Text=""></asp:textbox>;
               <br />

                <asp:Label ID="lblNpwd" runat="server" Text="New Password"></asp:Label>
          <asp:textbox ID="txtNpwd" runat="server" Text=""></asp:textbox>
                    <br />

          <asp:Label ID="lblCpwd" runat="server" Text="Confirm Password"></asp:Label>
           <asp:textbox ID="txtCpwd" runat="server" Text="" ></asp:textbox>

       <asp:button  ID="btnUpdate" runat="server" Text="Update"
                  OnClientClick="javascript:showHelloWorld()"  Width="84px"></asp:button>
 <asp:Label ID="lblStatus" ForeColor="Red" runat="server">

Thanks in advance,
Updated 16-Jun-11 19:19pm

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

It looks like the click event is working inside the update panel but you are trying to open some alert so it is not working.

You have to do something else

string showHelloWorld = "alert('Hello World');";

ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "msg", showHelloWorld, true);

and write this in the click event

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100