views:

804

answers:

2

Hi,

Ok, I have a masterpage, on that i have a linkbutton, popupcontrolextender, a panel as the popupcontrol and within the panel a login control.

When the linkbutton is fired the popup panel reveals itself with the login control inside, if i try to login, the authenticate method does not fire.

I have tried many different ways of getting this to work but the page seems to post back ok, but just will not fire the onauthenticate method.

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
         <asp:Panel ID="pnlLogin" runat="server">
        <asp:Login ID="Login1" OnAuthenticate="Login1_Authenticate" runat="server">
        </asp:Login>
        </asp:Panel>
        <asp:LinkButton ID="LinkButton1"  runat="server">LinkButton</asp:LinkButton>
        <cc1:PopupControlExtender ID="PopupControlExtender1" TargetControlID="LinkButton1" Position="Right" PopupControlID="pnlLogin" runat="server">
        </cc1:PopupControlExtender>

        </ContentTemplate>
        </asp:UpdatePanel>

If i take the login control out of the popup panel and plonk it on the page, guess what, the onauthenticate method fires!

Any ideas people?

Thanks

A: 
<asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="true" UpdateMode="Conditional">
        <ContentTemplate>
            <asp:Panel ID="pnlLogin" runat="server">

                <asp:Login ID="Login1" OnAuthenticate="Login1_Authenticate" runat="server">
                </asp:Login>
                    <asp:Button runat="server" Text="Button" ID="Unamed2" onclick="Unnamed2_Click" />


            </asp:Panel>
            <asp:LinkButton ID="LinkButton1" runat="server">LinkButton</asp:LinkButton>

            <cc1:ModalPopupExtender PopupControlID="pnlLogin" runat="server" ID="PopupControlExtender1"
                TargetControlID="LinkButton1">
            </cc1:ModalPopupExtender>
       </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="Unamed2" />
            <asp:AsyncPostBackTrigger ControlID="Login1" />
        </Triggers>
    </asp:UpdatePanel>

protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) { this.PopupControlExtender1.Show(); }

This works fine now.....Final Updated code...Sorry for the mess about...

chugh97
Sorry, this didnt work, i put the login control inside an update panel but the onauthenticate didnt fire.
Instead of using the Button try putting ControlID="Login1" in the AsyncPostBackTrigger, I tried it with a button and I can break into the button click event handler
chugh97
Yes the code you posted has worked, but you have used a modalpopup extender, not a popupcontrol extender, if i try your code with a popupcontrol it doesnt work?
+1  A: 

I've figured it out!

I found a useful post here

http://www.brianrudloff.com/

they say

I recently ran into an issue where I was trying to dynamically create a Panel with Buttons, Labels, ect and have it popup using the AJAX PopupControlExtender. The problem was that whenever you would click on the Button, it wouldn't fire the click event. The event was there, it just wouldn't execute. Anyway, to make a long story short.. I had to change the Button's UseSubmitBehaviour to false to get it working.

i.e ( Button1.UseSubmitBehavior = false);

Hopefully, someone will find this post and save themselves some time.

So, i changed the button type of the login control to a link, it worked!!! it's some kind of bug with the popupextender me thinks!

Thanks for letting me know....
chugh97