[RESOLVED]Modal Popup Extender is not working

Hi all,

Trying to make a panel pop up with a modal popup extender. Have done it many times but now for some reason this one is not working.

Here’s the code:

<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="docmanager.aspx.vb" Inherits="documents_docmanager" %>

<%@ Register assembly="CuteEditor" namespace="CuteEditor" tagprefix="CE" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
  
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    <asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
    
    </asp:ScriptManagerProxy>

 <asp:LinkButton ID="lbshowupload" runat="server" Text = "Upload a file"
             />
            <act:ModalPopupExtender ID="mpe" runat="server"
        TargetControlID="lbshowupload" PopupControlID="pnlupload" CancelControlID="closebutton" OkControlID="btnAddFiles"
        BackgroundCssClass="dialog_background"></act:ModalPopupExtender>

    
    <div class="searchlistings">
     <asp:HiddenField ID="hfuid" runat="server" />
       



        <asp:SqlDataSource ID="dssections" runat="server"
            ConnectionString="<%$ ConnectionStrings:ApplicationServices %>"
            
            SelectCommand="SELECT DISTINCT sections.section_id, sections.sectionname, (SELECT COUNT(*) AS Expr1 FROM filesinsections WHERE (sections.section_id = section_id)) AS doc_count, aspnet_UsersInRoles.UserId FROM sections INNER JOIN aspnet_UsersInRoles INNER JOIN SectionsInRoles ON aspnet_UsersInRoles.RoleId = SectionsInRoles.RoleId ON sections.section_id = SectionsInRoles.section_id WHERE (sections.is_active = @is_active) AND (aspnet_UsersInRoles.UserId = @UserId) OR (sections.is_active = 1) AND (sections.section_id = 1)">
            <SelectParameters>
                <asp:Parameter DefaultValue="true" Name="is_active" />
                <asp:ControlParameter ControlID="hfuid" DefaultValue="" Name="UserId"
                    PropertyName="Value" />
            </SelectParameters>
        </asp:SqlDataSource>
       
        <asp:DataList ID="DLSectionDocs" runat="server"
            DataKeyField="section_id" DataSourceID="dssections" Width="100%"
            ShowFooter="true" BorderStyle="None" ShowHeader="true">

            <HeaderTemplate>
            <div class="searchresultssectionname">
                <asp:Label ID="Label6" runat="server" CssClass="title"
                    Text='<%# Eval("sectionname") %>'></asp:Label>
                    </div>
            </HeaderTemplate>
            <ItemTemplate>
                <asp:Label ID="Label8" runat="server" style="font-weight: 700"
                    Text='<%# Eval("sectionname") %>'></asp:Label>
                <asp:Label ID="Label7" runat="server" Text='<%# Eval("doc_count", "({0})") %>'></asp:Label>
                <asp:HiddenField ID="hfsectionid" runat="server"
                    Value='<%# Eval("section_id") %>' />
                <asp:SqlDataSource ID="dsdocs" runat="server"
                    ConnectionString="<%$ ConnectionStrings:ApplicationServices %>"
                    SelectCommand="SELECT dm_files.file_id, dm_files.file_name, dm_files.date_uploaded, dm_files.file_type, dm_files.file_size, dm_files.downloadcount, dm_files.file_title, dm_files.keywords, dm_files.fileguid, filesinsections.section_id FROM dm_files INNER JOIN filesinsections ON dm_files.file_id = filesinsections.file_id WHERE (filesinsections.section_id = @section_id)">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="hfsectionid" Name="section_id"
                            PropertyName="Value" />
                    </SelectParameters>
                </asp:SqlDataSource>
                <asp:UpdatePanel ID="upfilelist" runat="server">
                    <ContentTemplate>
                    
                <asp:GridView ID="gvfiles" runat="server" AllowPaging="True"
                    AutoGenerateColumns="False" BorderStyle="None" DataKeyNames="file_id"
                    DataSourceID="dsdocs" EmptyDataText="No Files Listed for this section"
                    PageSize="5" Width="100%" ShowFooter="false" GridLines="None" FooterStyle-CssClass="searchfootertemplate">
                    <Columns>
                        <asp:TemplateField HeaderText="" InsertVisible="False"
                            SortExpression="file_id">
                            <EditItemTemplate>
                                <asp:Label ID="Label1" runat="server" Text='<%# Eval("file_id") %>'></asp:Label>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:LinkButton ID="LinkButton1" runat="server"
                                    CommandArgument='<%# Bind("fileguid") %>' CssClass="searchfiletitle"
                                    Text='<%# Bind("file_title") %>' onclick="LinkButton1_Click"></asp:LinkButton>
                                &nbsp;<asp:Label ID="Label11" runat="server"
                                    Text='<%# Bind("file_type", "File Type: {0}") %>'></asp:Label>
                                <asp:Label ID="Label12" runat="server"
                                    Text='<%# Bind("file_size", " Size: {0} mb") %>'></asp:Label>
                                <br />
                                <asp:Label ID="Label13" runat="server" CssClass="sideeventsdate"
                                    Text='<%# Bind("downloadcount", "Downloaded {0} time(s) ") %>'></asp:Label>
                                &nbsp;<asp:Label ID="Label10" runat="server" CssClass="sideeventsdate"
                                    Text='<%# Eval("date_uploaded", "Uploaded On: {0:G}") %>'></asp:Label>
                                <br />
                                <asp:Label ID="Label9" runat="server" CssClass="searchfilekeywords"
                                    Text='<%# Eval("keywords", "Keywords: {0}") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <FooterStyle CssClass="searchfootertemplate" />
                </asp:GridView>
                </ContentTemplate>
                </asp:UpdatePanel>
                
            </ItemTemplate>
            <FooterTemplate><div style="margin-bottom: 15px;"></div></FooterTemplate>
        </asp:DataList>
    <br />

    <asp:Panel ID="pnlupload" runat="server" CssClass="modalpopup">
         <asp:Panel ID="addfiletitle" runat="server" CssClass="dialog_title">
            <div class="modalpopup_title"><asp:Image ID="closebutton" runat="server"
                    ImageUrl="~/images/closebutton.gif"
                    style="float:right;cursor:pointer;margin-right:5px;margin-top:5px;" />
            <div id="popuptitletext" style="text-align:center;">Upload Documents</div>
            </div>
      </asp:Panel>
  
       
      <div class="modalpopup_modalbody">
            <asp:Label ID="Label1" runat="server" Text="&lt;h1&gt;Upload File&lt;/h1&gt;"></asp:Label>
            <table style="width:100%;">
               
                <tr>
                    <td class="style1">
                        <asp:Label ID="Label2" runat="server" Text="File Title:" Font-Bold="True"></asp:Label>
                    </td>
                    <td>
                        &nbsp;</td>
                    <td>
                        <asp:TextBox ID="txttitle" runat="server" Width="380px"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="style1">
                        <asp:Label ID="Label3" runat="server" Text="Keywords (Aids in file search)"
                            Font-Bold="True"></asp:Label>
                    </td>
                    <td>
                        &nbsp;</td>
                    <td>
                        <asp:TextBox ID="txtkeywords" runat="server" Width="380px"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="style1">
                        <asp:Label ID="Label5" runat="server" Font-Bold="True" Text="Section:"
                            ToolTip="The section this file is most associated with."></asp:Label>
                    </td>
                    <td>
                        &nbsp;</td>
                    <td>
                          <asp:DropDownList ID="ddldirectory" runat="server" DataSourceID="dsauthorizedpages"
                        DataTextField="sectionname" DataValueField="section_id" Width="380px">
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="dsauthorizedpages" runat="server" ConnectionString="<%$ ConnectionStrings:ApplicationServices %>"
                        SelectCommand="SELECT        sections.sectionname, sections.section_id FROM            sectioneditorroles INNER JOIN                          aspnet_UsersInRoles ON sectioneditorroles.RoleId = aspnet_UsersInRoles.RoleId INNER JOIN                          sections ON sectioneditorroles.section_id = sections.section_id WHERE        (aspnet_UsersInRoles.UserId = @userid)">
                        <SelectParameters>
                            <asp:ControlParameter ControlID="hfuid" Name="userid" PropertyName="Value" />
                        </SelectParameters>
                    </asp:SqlDataSource>
                    </td>
                </tr>
                <tr>
                    <td class="style1">
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        <asp:CheckBox ID="CheckBox1" runat="server"
                            Text="Members Only? (Leave unchecked to make this file public.)" />
                    </td>
                </tr>
                <tr>
                    <td class="style1">
                        <asp:Label ID="Label4" runat="server" Font-Bold="True" Text="File:"></asp:Label>
                    </td>
                    <td>
                        &nbsp;</td>
                    <td>
                        <CE:UploadAttachments ID="Attachments1" runat="server"
                            FileTypeNotSupportMsg="Invalid File Type"
                            InsertText="Select A File To Upload..." MultipleFilesUpload="False"
                            ShowProgressInfo="False">
                            <ValidateOption AllowedFileExtensions="doc,docx,xls,xlsx,ppt,pptx,pdf,zip,mp3,mp4,jpg,gif,avi,mov,png,psd" />
                        </CE:UploadAttachments>
                    </td>
                </tr>
                <tr>
                    <td class="style1">
                       
                    </td>
                    <td>
                        &nbsp;</td>
                    <td>
                         <asp:Button ID="btnAddFiles" runat="server" Text="Add Files" />
                        &nbsp;<asp:Button ID="btnCancel" runat="server" Text="Cancel" Visible="False" /></td>
                </tr>
            </table>
                        <asp:ListBox runat="server" ID="ListBoxEvents" Width="380"></asp:ListBox>
        </div>
        
        </asp:Panel>
    </div>
    
</asp:Content>

I appreciate a fresh set of eyes on this and hopefully can point out what I’m missing.

Thanks all,

hi 

on your page i can’t see the ajax register assembly 

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

Hello,

The assembly is registered in the web.config file.

I got this to work by moving the modal and panels to the masterpage (it should be there anyway) and all of the panels that will be shown modally right before the </form> tag. 

This seemed to do the trick.

Leave a Reply