Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#3.0
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 14:25pm
Edited 20-Sep-12 14:37pm
v2
Comments
Arun (Multithreaded) at 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 at 20-Sep-12 23:11pm
   
Nice....
This will solve yr problem.
Mohamed Mitwalli at 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
0 Marcin Kozub 330
1 OriginalGriff 256
2 Sergey Alexandrovich Kryukov 215
3 Praneet Nadkar 197
4 Richard MacCutchan 182
0 OriginalGriff 8,048
1 Sergey Alexandrovich Kryukov 7,287
2 DamithSL 5,614
3 Manas Bhardwaj 4,986
4 Maciej Los 4,910


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 20 Sep 2012
Copyright © CodeProject, 1999-2014
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