Click here to Skip to main content
15,888,968 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have placed a button inside an update panel content template.The problem is that the button click event is not fired upon clicking the button:
Asp:
XML
<asp:Panel ID="Panel2" runat="server" CssClass="HellowWorldPopup" Height="37px" style="margin-top: 0px">
        <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
         <ContentTemplate>


        <asp:Button ID="Button2" runat="server" Style="display:none" />


        <asp:ModalPopupExtender ID="Unauthenticated_popup" runat="server"
           TargetControlID="Button2" PopupControlID="Panel2" CancelControlID="OkButton2" DropShadow="true" >
        </asp:ModalPopupExtender>
        <legend style="font-family: Tahoma; font-size: small; font-weight: bold; font-style: normal; font-variant: normal; text-transform: none; color: #000000; text-decoration: blink">ICT UNAUTHORIZED USER
        </legend>
        <asp:Label ID="lbldisplay" runat="server" />
        <asp:Button ID="OkButton2" runat="server" Text="Ok" CausesValidation="false" OnClick="redirect_login" CssClass="button"/>&nbsp;
        </ContentTemplate>
         </asp:UpdatePanel>
    </asp:Panel>

and
C#
protected void redirect_login(object sender,EventArgs e)
   {
       Response.Redirect("Login.aspx");
   }
Posted
Updated 20-Sep-12 13:37pm
v2
Comments
Rock (Multithreaded) 20-Sep-12 20:28pm    
Update Panel is a Ajax Component.
You need to add Ajax functionality to your webpage.

1 solution

Hi ,
Check this
AsyncPostBackTrigger
XML
<asp:Panel ID="Panel2" runat="server" CssClass="HellowWorldPopup" Height="37px" style="margin-top: 0px">
       <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
        <ContentTemplate>


       <asp:Button ID="Button2" runat="server" Style="display:none" />


       <asp:ModalPopupExtender ID="Unauthenticated_popup" runat="server"
          TargetControlID="Button2" PopupControlID="Panel2" CancelControlID="OkButton2" DropShadow="true" >
       </asp:ModalPopupExtender>
       <legend style="font-family: Tahoma; font-size: small; font-weight: bold; font-style: normal; font-variant: normal; text-transform: none; color: #000000; text-decoration: blink">ICT UNAUTHORIZED USER
       </legend>
       <asp:Label ID="lbldisplay" runat="server" />
       <asp:Button ID="OkButton2" runat="server" Text="Ok" CausesValidation="false" OnClick="redirect_login" CssClass="button"/>&nbsp;
       </ContentTemplate>
           <Triggers>
               <asp:AsyncPostBackTrigger ControlID="OkButton2" EventName="Click" />
           </Triggers>
        </asp:UpdatePanel>

http://msdn.microsoft.com/en-us/library/system.web.ui.asyncpostbacktrigger.aspx[^]
http://ajax.net-tutorials.com/controls/updatepanel-control/[^]
Best Regards
M.Mitwalli
 
Share this answer
 
v2
Comments
Himanshu Yadav 20-Sep-12 23:11pm    
Nice....
This will solve yr problem.
Mohamed Mitwalli 21-Sep-12 9:20am    
Thanks Himanshu

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