Link to home
Start Free TrialLog in
Avatar of WanaBRich
WanaBRichFlag for United States of America

asked on

How do I access the ModalPopupExtender that lives on the MasterPage from a content Page?

The first part of the code lives in the master page.

The second one lives on a content page that I want the modelpopup to appear on.

My thought is that I can use mpeNewCustomer.Show(); to invoke it but not sure this will work yet;
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server" >
            <asp:Panel ID="pnlNewCustomer" runat="server" Style="display: none">
                <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
                    DataKeyNames="CustomerID"  DefaultMode="Insert" DataSourceID="ldsCustomer" Height="50px" 
                    Width="125px">
                    <Fields>
                        <asp:BoundField DataField="SecurityID" HeaderText="SecurityID" 
                            SortExpression="SecurityID" />
                        <asp:BoundField DataField="CustomerCompanyName" 
                            HeaderText="CustomerCompanyName" SortExpression="CustomerCompanyName" />
                        <asp:BoundField DataField="CustomerAddress" HeaderText="CustomerAddress" 
                            SortExpression="CustomerAddress" />
                        <asp:BoundField DataField="CustomerCity" HeaderText="CustomerCity" 
                            SortExpression="CustomerCity" />
                        <asp:BoundField DataField="CustomerState" HeaderText="CustomerState" 
                            SortExpression="CustomerState" />
                        <asp:BoundField DataField="CustomerZip" HeaderText="CustomerZip" 
                            SortExpression="CustomerZip" />
                        <asp:BoundField DataField="CustomerPhone" HeaderText="CustomerPhone" 
                            SortExpression="CustomerPhone" />
                        <asp:BoundField DataField="CustomerContactName" 
                            HeaderText="CustomerContactName" SortExpression="CustomerContactName" />
                        <asp:BoundField DataField="CustomerContactEMail" 
                            HeaderText="CustomerContactEMail" SortExpression="CustomerContactEMail" />
                        <asp:CheckBoxField DataField="CustomerIsActive" HeaderText="CustomerIsActive" 
                            SortExpression="CustomerIsActive" />
                        <asp:CommandField ButtonType="Button" ShowInsertButton="True" />
                    </Fields>
                </asp:DetailsView>
                <asp:LinqDataSource ID="ldsCustomer" runat="server" 
                    ContextTypeName="MyDatabaseDataContext" EnableInsert="True" 
                    TableName="Customers">
                </asp:LinqDataSource>
                <div>
                    <asp:Button ID="btnDone" runat="server" Text="Done" />
                </div>
            </asp:Panel>
            <cc1:ModalPopupExtender ID="mpeNewCustomer" runat="server" DynamicServicePath=""
                Enabled="True" PopupControlID="pnlNewCustomer" TargetControlID="pnlNewCustomer"
                BackgroundCssClass="modalBackground" DropShadow="true" CancelControlID="btnDone">
            </cc1:ModalPopupExtender>
        </asp:contentplaceholder>
 
 
 
 protected void Button3_Click(object sender, EventArgs e)
    {
       cc1:ModalPopupExtender
        var cust = Master.FindControl("mpeNewCustomer");
       
    }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of WanaBRich

ASKER

Does it need to be a public property or can it be a public method?
If real deal is the ModalPopupExtender that I want invoked from a content page that has a master page will not center / work correctly.
Do the ModalPopupExtender work, just not rendering correctly?
OK The Issue I have is that when the modle popup is invoke I have a detailsview in the panel the detailsview has a checkbox and A insert button but I can't get anything to happen when the insert button is clicked
That was a correct answer. A code snippet would have been a bit better.