|
Rank: Advanced Member Groups: Member
Joined: 9/6/2007 Posts: 133
|
I have a Dialog control with no Accept button. Within the dialog is an updatepanel that contains a small login form with a postback button. When the user clicks the "Return" key, the dialog just closes. Why? How can I keep the dialog window open until the close button (X in upper-right) is clicked? Thanks!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
As a general rule, if you use UpdatePanel and do not want the dialog to close, you would usually place the UpdatePanel inside the dialog instead of the other way around. If you place the dialog inside the UpdatePanel, every time the UpdatePanel is updated, the dialog will be updated --- that means destroying and recreating the dialog, which would naturally close the dialog.
If that is not the problem, then you can post a full test page demonstrating the problem and we will be happy to take a look. Please make sure the test page runs and only contains code needed to reproduce the problem.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 9/6/2007 Posts: 133
|
The UpdatePanel is inside the Dialog. Below is a test page. Note that when the user enters text into the username and password fields, and then clicks "Return" on the keyboad, the dialog closes. Why does it close? Thank you.
Codebehind: protected void Page_Load(object sender, EventArgs e) { dlgLogin.Show(); }
ASPX: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="test" %> <%@ Register Assembly="EO.Web" Namespace="EO.Web" TagPrefix="eo" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" /> <eo:Dialog runat="server" ID="dlgLogin" Width="320px" Height="120px" OffsetY="-350" OffsetX="200" ControlSkinID="None" HeaderHtml="Dialog Title" CloseButtonUrl="00020440" AllowResize="True" HeaderHtmlFormat='<div style="padding-top:4px">Sign In</div>' HeaderImageUrl="00020441" HeaderImageHeight="27" MinWidth="150" MinHeight="100" BackShadeColor="Black" BackShadeOpacity="40" EnableKeyboardNavigation="false"> <ContentTemplate> <div style="padding: 10px;"> <div id="divLogin" runat="server" style=""> <span id="spanMessage" style="color: #cc0000;"></span> <asp:UpdatePanel runat="server" ID="UpdatePanelLogin" UpdateMode="Always"> <ContentTemplate> <table cellpadding="0" cellspacing="0"> <tr> <td align="right"> Username: </td> <td> <asp:TextBox ID="tbUsername" runat="server" Width="100" ValidationGroup="login" /> <asp:RequiredFieldValidator ValidationGroup="login" ControlToValidate="tbUsername" Display="Static" ErrorMessage=" *" runat="server" ID="vUserName" /> </td> </tr> <tr> <td align="right"> Password: </td> <td> <asp:TextBox ID="tbPassword" TextMode="Password" runat="server" Width="100" ValidationGroup="login" /><asp:RequiredFieldValidator ControlToValidate="tbPassword" Display="Static" ErrorMessage=" *" runat="server" /> <asp:Button ID="btnLogin" Text="Sign In" runat="server" CssClass="btn" /> </td> </tr> </table> </ContentTemplate> </asp:UpdatePanel> </div> </div> </ContentTemplate> <FooterStyleActive CssText="padding-right: 4px; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; padding-top: 4px; font-family: tahoma"> </FooterStyleActive> <HeaderStyleActive CssText="background-image:url(00020442);color:#444444;font-family:'trebuchet ms';font-size:10pt;font-weight:bold;padding-bottom:0px;padding-left:8px;padding-right:0px;padding-top:0px;"> </HeaderStyleActive> <ContentStyleActive CssText="background-color:#eeeeee;font-family:tahoma;font-size:8pt;padding-bottom:4px;padding-left:4px;padding-right:4px;padding-top:4px"> </ContentStyleActive> <BorderImages BottomBorder="00020409,00020429" RightBorder="00020407,00020427" TopRightCornerBottom="00020405,00020425" TopRightCorner="00020403,00020423" LeftBorder="00020406,00020426" TopLeftCorner="00020401,00020421" BottomRightCorner="00020410,00020430" TopLeftCornerBottom="00020404,00020424" BottomLeftCorner="00020408,00020428" TopBorder="00020402,00020422"></BorderImages> </eo:Dialog> </form> </body> </html>
|
|
Rank: Advanced Member Groups: Member
Joined: 9/6/2007 Posts: 133
|
I think I found a solution:
ClientSideOnAccept="cancel_handler"
function cancel_handler() { return false; }
Well...at least it's on the right track. Of course, now I can't close the dialog at all. :)
|
|
Rank: Advanced Member Groups: Member
Joined: 9/6/2007 Posts: 133
|
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
That makes sense. If you are talking about enter key on the keyboard, then it has nothing to do with UpdatePanel. Glad that you got it working!
Thanks!
|
|