ModalPopup不在ASP.Net中显示

时间:2011-06-23 16:09:20

标签: asp.net vb.net show modalpopupextender

我做了一切。删除代码并从工具箱中拖出新控件,重命名,尝试从javascript - 我只是无法得到这个freakin'modalpopupextender来显示。浪费了3天。

即使是登录按钮,我也试图通过VB代码隐藏来显示它。其他所有内容都在按钮的代码中执行,而不是这一行:

Me.ModalPopupExtender2.Show()

但无论我尝试什么,它都喜欢隐藏。

欢迎任何想法!谢谢,

杰森

PS - 这是aspx编码

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Login.aspx.vb" Inherits="LetterWriterASP.Login" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head id="Head2"><meta http-equiv="Expires" content="-1" /><title>
Anchor General Insurance Agency, Inc.
</title><meta http-equiv="Expires" content="-1" /><link rel="shortcut icon" href="Images/favicon.ico" /><link href="App_Themes/Default/Calendar.css" type="text/css" rel="stylesheet" /><link href="App_Themes/Default/Default.css" type="text/css" rel="stylesheet" />
    </head>

<style type="text/css">
    .ModalPopupBG
    {
    background-color: #666699;
    filter: alpha(opacity=50);
    opacity: 0.7;
    }

    .HellowWorldPopup
    {
    min-width:200px;
    min-height:100px;
    background:white;
    border-color:Silver;
    border-style:ridge;
    border-width:medium;

    }
    .HeaderStyle
    {
     color:Black;
     background-color:Black;
     border-style:solid;
    }
    .PopupHeader
    {
    color:Black;
    background-color: Black;
    }
 </style>


<body leftmargin="0" topmargin="0"
background="Images/tile-grey-stripe.jpg">
<form id="Form1" runat="server">



    <table width="1000" height="99" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
            <td width="35" background="../Images/a_ag01.jpg"></td>
            <td width="524"><img src="Images/a_ag1.jpg" alt="" width="524" height="99" border="0" align="top" /></td>
            <td width="389">
                <table border="0" cellspacing="0" cellpadding="0" width="389">
                    <tr>
                        <td width="218"><img id="imgHeader" src="Images/text_title_producer1.jpg" style="height:99px;width:218px;border-width:0px;" /></td>
            <td width="111"><img id="imgHeadr2" src="Images/text_title-TILE.jpg" style="height:99px;width:171px;border-width:0px;" /></td>
                    </tr>
                </table>
            </td>
            <td width="19" align="right"><img src="Images/a_ag4_end.jpg" width="19" height="99" alt="" /></td>
            <td align="right" width="33" background="Images/a_ag5.jpg"></td>
        </tr>
    </table>
    <!--end of the header table -->
    <table height="702" width="1000" border="0" cellpadding="0" cellspacing="0" align="center">
        <tr>
            <td width="50" background="Images/b_ag1_lefttile.jpg"> <!-- This is the left wall of the form !-->
                &nbsp;</td>
            <td width="900" valign="top" bgcolor="#FFFFFF">
<!-- Text, controls, buttons, etc goes below this comment. !--> 

<script type="text/javascript">

function InvalidLogin()
{
alert("Invalid user name or password. Please try again.");
window.location = "../Login.aspx";
}

function ShowModal()
{$find('ModalPopupExtender2').show();}


</script>



                        <br /><br /><br /><br /><br /><br /><br />
                       <center><table border="2" cellpadding="4" cellspacing="0" 
                           style="border-collapse:collapse;">
                           <tr>
                               <td>
                                   <table border="0" cellpadding="0" style="height:172px;width:278px;">
                                       <tr>
                                           <td align="center" colspan="2" 
                                               style="color:White;background-color:#5D7B9D;font-size:0.9em;font-weight:bold;">
                                               Log In</td>
                                       </tr>
                                       <tr>
                                           <td align="right">
                                               <asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">User 
                                               Name:</asp:Label>
                                           </td>
                                           <td>
                                               <asp:TextBox ID="UserName" Width="150" name="UserName" runat="server" Font-Size="0.8em"></asp:TextBox>
                                               <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" 
                                                   ControlToValidate="UserName" ErrorMessage="User Name is required." 
                                                   ToolTip="User Name is required." ValidationGroup="Login1">*</asp:RequiredFieldValidator>
                                           </td>
                                       </tr>
                                       <tr>
                                           <td align="right">
                                               <asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password:</asp:Label>
                                           </td>
                                           <td>
                                               <asp:TextBox ID="Password" Width="150" runat="server" Font-Size="0.8em" TextMode="Password"></asp:TextBox>
                                               <asp:RequiredFieldValidator ID="PasswordRequired" runat="server" 
                                                   ControlToValidate="Password" ErrorMessage="Password is required." 
                                                   ToolTip="Password is required." ValidationGroup="Login1">*</asp:RequiredFieldValidator>
                                           </td>
                                       </tr>
                                       <tr>
                                           <td align="center" colspan="2" style="color:Red;">
                                               <asp:Literal ID="FailureText" runat="server" EnableViewState="False"></asp:Literal>
                                           </td>
                                       </tr>
                                       <tr>
                                           <td align="right" colspan="2">
                                               <asp:Button ID="LoginButton" runat="server" BackColor="#FFFBFF" 
                                                   BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px" CommandName="Login" 
                                                   Font-Names="Verdana" Font-Size="0.8em" ForeColor="#284775" 
                                                   onclick="LoginButton_Click1" Text="Log In" ValidationGroup="Login1" />
                                           </td>
                                       </tr>
                                   </table>
                               </td>
                           </tr>
                       </table>     </center>               


<!-- Text, controls, buttons, etc goes above this comment. !-->     
                 <!--"#E6E2D8" "Black"-->    
            </td>
            <td width="50" background="Images/b_ag1_righttile.jpg"> <!-- This is the right wall !-->
                &nbsp;</td>
        </tr>
    </table>
    <!--end of content table -->
    <table height="75" width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
            <td width="80" background="Images/c_ag1_leftcorner.jpg"></td>
            <td width="840" align="center" valign="top" background="Images/c_ag1_center-piece.jpg" class="contents">
                <span id="lblFooter"><center>Copyright &#0169; 2006 Anchor General Insurance Agency, Inc. All rights reserved. <br />For questions, please call: (800) 542-6246</center></span>
            </td>
            <td width="80" background="Images/c_ag1_rightcorner.jpg"></td>
        </tr>
    </table>







<!-- Popup Form --> 
<asp:ToolkitScriptManager ID="ToolkitScriptManager2" runat="server" EnablePageMethods="true">
                        </asp:ToolkitScriptManager>
<asp:button id="Button3" name="Button3" runat="server" text="Button" style="display: none;" />

<asp:ModalPopupExtender ID="ModalPopupExtender2" runat="server"
targetcontrolid="Button3" popupcontrolid="PopupPanel" 
popupdraghandlecontrolid="PopupHeader2" drag="true" 
backgroundcssclass="ModalPopupBG">
</asp:ModalPopupExtender>

<asp:Panel ID="PopupPanel" style="display: none" runat="server">
    <div class="HellowWorldPopup">
            <div class="PopupHeader" id="PopupHeader2">&nbsp;</div>
            <div class="Controls">
                <center><table border=0 cellpadding=0 cellspacing=0><tr><td><img src="Images/ajax-loader.gif" /></td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Please Wait...</td></tr></table></center>
            </div>
    </div>
</asp:Panel>


</form>
</body>
</html>

1 个答案:

答案 0 :(得分:0)

快来找出(经过长时间的试验和错误),每个人都应该知道一些事情。

您无法复制

<ToolkitScriptManager>

从一个aspx页面到另一个页面的代码。您必须将其从工具箱拖到页面上。我想它会做一些我们看不到或不知道的事情。同样可能适用于ModalPopupExtender。

希望能帮到那里的人!

相关问题