You must Sign In to post a response.
  • Category: ASP.NET

    Sub Form in Page

    Hi Guys,

    I opening a subform from a main form GridView column click. Now I want to make the main form disable till the subform is closed. Till we close the subform, no action should be performed in the main form, i.e the main form should be disabled in the back of the subform.

    Help me giving an idea.

    Rajabharathi R
  • #764171
    Hai Rajabharathi,
    There could be many ways to do it, but the simplest one is using the javascript window.openDialog method where you can provide the url of the child page and the height and width of the form.
    This will open the new window as a Dialog so that it will prevent the main page to go without closing the dialog form.
    The other way could e using the Model popup extender control under the Ajax control toolkit that can also be used for the same.
    The new Html5 is also having a JavaScript function called as showModalDialog() which can also be used for the same.
    Hope it will be helpful to you.

    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)

  • #764172
    You can use javascript to accomplish your task, basically 'window.showModalDialog()' method is used to Creates a modal dialog box that displays the specified HTML document.
    var retval = window.showModalDialog(dialog, varArgIn, varOptions);
    see below sample

    <p>Click the button to show the dialog.</p>

    <button onclick="myFunction()">Show dialog</button>

    <p><b>Note:</b> Use the "Esc" button to close the modal.</p>
    <p><b>Note:</b> The dialog element is only supported in Chrome 37+, Safari 6+ and Opera 24+.</p>

    <dialog id="myDialog">This is a dialog window</dialog>

    function myFunction() {


    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #764177

    You can do it using CSS styles refer below sample

    <style type="text/css">

    background-color: Black;
    filter: alpha(opacity=90);
    opacity: 0.8;
    <script type="text/javascript">
    function closepopup() {
    $("#<%=pnlPopup.ClientID %>").hide();

    </head><body> <form id="form1" runat="server"> <div align="center"> <span class="style1"><strong>Ajax Modal PopUp</strong></span><br /> <br />
    <asp:Button ID="btnShowPopup" Text="Show Popup" runat="server" Style="display: none" />
    <cc1:ModalPopupExtender ID="mpe" runat="server" TargetControlID="btnShowPopup"
    PopupControlID="pnlPopup" BackgroundCssClass="modalBackground">
    <asp:Panel ID="pnlPopup" runat="server" BackColor="White" Height="100px"
    Width="400px" Style="display: none">
    <table width="100%" style="border: Solid 2px #D46900; width: 100%; height: 100%"
    cellpadding="0" cellspacing="0">
    <tr style="background-image: url(~/Images/header.gif)">
    <td style="height: 10%; color: White; font-weight: bold; padding: 3px; font-size: larger;
    font-family: Calibri" align="left">
    Confirm Box
    <td style="color: White; font-weight: bold; padding: 3px; font-size: larger" align="right">
    <a href="javascript:void(0)" onclick="closepopup()">
    <img src="~/Images/Close.gif" style="border: 0px" align="right" /></a>
    <td colspan="2" align="left" style="padding: 5px; font-family: Calibri; font-size: 12px;">
    <asp:Label ID="lblCancelText" runat="server" Text="Are you sure you want to cancel?"></asp:Label>
    <td colspan="2">

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

    Give respect to your work, Instead of trying to impress your boss.

    Blog :

  • Sign In to post your comments