Click here to Skip to main content
12,349,148 members (61,798 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C#3.0 C#
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:
<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
protected void redirect_login(object sender,EventArgs e)
   {
       Response.Redirect("Login.aspx");
   }
Posted 20-Sep-12 13:25pm
Edited 20-Sep-12 13:37pm
v2
Comments
Arun (Multithreaded) 20-Sep-12 20:28pm
   
Update Panel is a Ajax Component.
You need to add Ajax functionality to your webpage.

1 solution

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

Solution 1

Hi ,
Check this
AsyncPostBackTrigger
<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
  Permalink  
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160621.1 | Last Updated 20 Sep 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

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