0

I am using Modal popup for displaying different page in a popup and parent page is not editable

here is my code

<asp:Button ID="btnModalPopup" runat="server" Text="" Visible="false" />
<asp:ModalPopupExtender ID="btnModalPopup_ModalPopupExtender" BehaviorID="btnModalPopup_ModalPopupExtender" runat="server" PopupControlID="ModalPopup" 
   BackgroundCssClass="ModalPopupBG" DynamicServicePath="" Enabled="True" TargetControlID="btnModalPopup"> </asp:ModalPopupExtender>
 <div id="ModalPopup" runat="server">
 <iframe id="iframePopup" runat="server" width="700" scrolling="yes" height="500"></iframe>
</div>

and code behind

iframePopup.Attributes.Add("src", "default.aspx");
btnModalPopup_ModalPopupExtender.Show();

But the iframe is showing in the main page not a popup please any body can help me

Kapil Khandelwal
  • 15,958
  • 2
  • 45
  • 52
navya
  • 144
  • 1
  • 1
  • 10

1 Answers1

0

Set Button Visible="true" & use style="display:none;":

<asp:Button ID="btnModalPopup" runat="server" style="display:none;" 
Text="" Visible="true" />

Visible="true" ensures the control is rendered.

And, by setting style="display:none;" you can hide the control.

Kapil Khandelwal
  • 15,958
  • 2
  • 45
  • 52