开发者

ModalPopup Not Showing in ASP.Net

开发者 https://www.devze.com 2023-03-15 11:42 出处:网络
I\'ve done everything. Deleted the code and dragged new controls from the toolbox, renamed, tried from javascript -- I just can\'t get this freakin\' modalpopupextender to show. Wasted 3 days.

I've done everything. Deleted the code and dragged new controls from the toolbox, renamed, tried from javascript -- I just can't get this freakin' modalpopupextender to show. Wasted 3 days.

I'm trying to show it via VB code-behind in the on-click even of the login button. Everything else executes in the button's code, just not this line:

Me.ModalPopupExtender2.Show()

But no matter what I try, it likes to stay hidden.

Any ideas would be welcome!!! Thanks,

Jason

PS -- here's the aspx coding

<%@ 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="#FFFBF开发者_Python百科F" 
                                                   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>


Come to find out (after a VERY long process of trial and error), there's a little something everybody should know about.

You cannot copy

<ToolkitScriptManager>

code from one aspx page to another. You MUST drag it from the toolbox onto your page. I guess it does some stuff we don't see or know about. Same probably goes for ModalPopupExtender.

Hope that helps somebody out there!

0

精彩评论

暂无评论...
验证码 换一张
取 消