views:

1983

answers:

3

Hi. I'm making lost password recovery on my login page and I'm doing it with ModalPopUpExtender, a Panel and two of those inside of an UpdatePanel. But somehow when clicking the "btnOkPassRequest" full postback happens. People had similiar problems with other controls, some that UpdatePanel obviously didn't encapsulate. But never with a Button. What am I missing?

<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager><asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>  
    <asp:HyperLink ID="HyperLink2" runat="server">HyperLink</asp:HyperLink>
    <cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server"TargetControlID="HyperLink2" BackgroundCssClass="ModalPopupBG" PopupControlID="pnlPopupPass" CancelControlID="btnCancelPassRequest" OkControlID="Button1"></cc1:ModalPopupExtender>
    <asp:Panel ID="pnlPopupPass" runat="server" CssClass="ModalPopup">   
      <div class="ModalHeader">Password recovery</div>
      <div class="ModalBody">
        <p>Please, enter username.....</p>
        <table>
        <tr>
             <td>Username</td>
             <td><asp:TextBox ID="tbModalUserName" runat="server" class="textbox"></asp:TextBox></td>            
         </tr>
          </table>
        <table>
         <tr>
       <td></td>
         <td><asp:Button ID="btnOKPassRequest" runat="server" Text="Request new password" CssClass="button-wide" onclick="btnOKPassRequest_Click" PostBackUrl="~/Login.aspx" /></td>
         <td><asp:Button ID="btnCancelPassRequest" runat="server" Text="Cancel" CssClass="button-wide"/></td>
         </tr>
        </table>        
      </div>
    <asp:Button ID="Button1" runat="server" Text="Button" />
    </asp:Panel>
</ContentTemplate>
<Triggers>
    <asp:AsyncPostBackTrigger ControlID="btnOKPassRequest" EventName="btnOKPassRequest_Click" />
</Triggers>

+1  A: 

I think EventName should just be "Click" not "btnOKPassRequest_Click" in the trigger

veggerby
fixed. It was there as an attempt of despair. Se also comment at Nick Clarke's. Any other idea? Thanx
the berserker
+1  A: 

Are you sure this should be there?

 PostBackUrl="~/Login.aspx"

As without this it works fine for me.

I also removed the trigger, but if you need the trigger then the EventName should be Click.

<asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <asp:HyperLink ID="HyperLink2" runat="server">HyperLink</asp:HyperLink>
            <asp:Panel ID="pnlPopupPass" runat="server" CssClass="ModalPopup">
                <div class="ModalHeader">
                    Password recovery</div>
                <div class="ModalBody">
                    <p>
                        Please, enter username.....</p>
                    <table>
                        <tr>
                            <td>
                                Username
                            </td>
                            <td>
                                <asp:TextBox ID="tbModalUserName" runat="server" class="textbox"></asp:TextBox>
                            </td>
                        </tr>
                    </table>
                    <table>
                        <tr>
                            <td>
                            </td>
                            <td>
                                <asp:Button ID="btnOKPassRequest" runat="server" Text="Request new password" CssClass="button-wide"
                                    OnClick="btnOKPassRequest_Click" />
                            </td>
                            <td>
                                <asp:Button ID="btnCancelPassRequest" runat="server" Text="Cancel" CssClass="button-wide" />
                            </td>
                        </tr>
                    </table>
                </div>
                <asp:Button ID="Button1" runat="server" Text="Button" />
            </asp:Panel>
        </ContentTemplate>
    </asp:UpdatePanel>
Nick Clarke
I have this PostBackUrl="~/Login.aspx" there because there are other controls on the page that post back to other URL.I found a problem at the form tag also, that I thaught was causing my problems (and I had need for PostBackUrl="~/Login.aspx to override it):<form id="Form1" method="POST" runat="server" action="/EFormsASP/Default.aspx">But when I removed action="..." it still isn't ok. Any other idea?
the berserker
As long as you want the UpdatePanel to postback to the same url as the form/page the PostBackUrl is not required.Are the other controls outside of the UpdatePanel in your example?
Nick Clarke
I know UpdatePanels don't play nice with all controls, so I did a search and found this:http://blogs.technet.com/kirtid/archive/2007/05/03/using-updatepanels-with-modalpopups.aspxMaybe it helps.
Nick Clarke
A: 

Actually the problem dissapeared when I switched to ajaxcontroltoolkit v1, instead of using 3.5, which is really confusing

the berserker