简体   繁体   English

asp.net登录控件

[英]asp.net login control

Ok, I have a masterpage, on that i have a linkbutton, popupcontrolextender, a panel as the popupcontrol and within the panel a login control. 好的,我有一个母版页,上面有一个链接按钮,popupcontrolextender,一个面板作为popupcontrol,并且在面板中有一个登录控件。

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. 当链接按钮被触发时,弹出面板将显示其内部的登录控件,如果我尝试登录,则不会触发authenticate方法。

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. 我尝试了许多不同的方法来使它起作用,但是页面似乎可以发回,但是不会触发onauthenticate方法。

<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! 如果我将登录控件从弹出面板中取出并在页面上对其进行了排列,请猜猜是什么,onauthenticate方法将触发!

Any ideas people? 有什么想法的人吗?

Thanks 谢谢

I've figured it out! 我知道了!

I found a useful post here 我在这里找到了有用的帖子

http://www.brianrudloff.com/ 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. 我最近遇到一个问题,我试图动态创建一个带有Buttons,Labels等的面板,并使用AJAX PopupControlExtender使其弹出。 The problem was that whenever you would click on the Button, it wouldn't fire the click event. 问题在于,只要您单击按钮,就不会触发click事件。 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. 无论如何,总而言之。.我必须将Button的UseSubmitBehaviour更改为false才能使其正常工作。

ie ( Button1.UseSubmitBehavior = false); 即(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! 我认为这是popupextender的某种错误!

<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(); protected void Login1_Authenticate(object sender,AuthenticateEventArgs e){this.PopupControlExtender1.Show(); } }

This works fine now.....Final Updated code...Sorry for the mess about... 现在工作正常.....最终更新的代码...很抱歉...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM