Click here to Skip to main content
16,004,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
In my .aspx page there is a modal popup which includes a form.There is a submit button in that form.I can saved data to the database by that form with no issue.But the button in the content page(Outside the pop up) is not firing when that button is clicked.Once the modal pop up is removed that button is working.

I have inspect elements - there the href of the button (button name - access) which is in the content page is shown as

href="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$MainContent$access", "", true, "", "", false, true))"

I am new to asp.net. Please help

update

XML
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent"  runat="server">
    <link href="Content/custom.css" rel="stylesheet" />
    <link href="css/jquery-ui.css" rel="stylesheet" />
    <script src="Scripts/jquery-1.10.2.js"></script>
    <script src="js/jquery-ui.js"></script>
     <script type="text/javascript">
         function LoadList() {
             document.getElementById("<%=lbnic.ClientID %>").style.display = 'none';
             var ds = null;
             ds = <%=listFilter %>
                   $("#txt").autocomplete({
                       source: ds
                       }
                   });
         }

         $(document).ready(function () {
             $('#txt').on('autocompletechange change', function () {
                 var st = this.value;
                 var res = st.split(" ")[1];
                 var rs = st.split(" ")[0];

                 if (res) {
                     document.getElementById("<%=lbnic.ClientID %>").style.display = 'inline';
                     //$('#lbnic').html(this.value);
                     document.getElementById("<%=lbnic.ClientID %>").innerHTML = res;
                     document.getElementById("<%=namelb.ClientID%>").innerHTML = rs;

                     document.getElementById("<%=HiddenField1.ClientID %>").value = res;
                 }
                 else document.getElementById("<%=HiddenField1.ClientID %>").value = 'none';

             });
         });

    </script>
    <asp:HiddenField ID="HiddenField1" runat="server" />
    <!--search-->
       <input type="text" id="txt" class="search-query form-control" placeholder="Search Patients" visible="false"/>

    <!--button to open popup-->
       <asp:Button ID="addnew" runat="server" Text="Add New Patient" CausesValidation="False" CssClass="btn btn-warning" ValidateRequestMode="Disabled" />

     <!-- panel-->
<asp:Panel ID="panelRegister" CssClass="modalPopup form-control" runat="server" Style="display:none;">                                      <asp:Label ID="niclb1" runat="server" Text="NIC"></asp:Label>

        <asp:TextBox ID="nic" CssClass="form-control" runat="server" CausesValidation="True"></asp:TextBox>

        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Please enter patient's NIC"    ControlToValidate="nic" Display="Dynamic" ForeColor="red"></asp:RequiredFieldValidator>

        <asp:Button ID="create" runat="server" CssClass="btn btn-primary" Text="Create" OnClick="create_Click" />
        <asp:Button ID="cancel" runat="server" CssClass="btn btn-default" Text="Cancel" CausesValidation="False" />

    </asp:Panel>

<ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server" BackgroundCssClass="modalBackground" PopupControlID="panelRegister" OkControlID="cancel" TargetControlID="addnew"></ajaxToolkit:ModalPopupExtender>



<asp:Label ID="sucess" runat="server" ForeColor="Green" Font-Bold="True"></asp:Label>

<asp:Label ID="lbnic" runat="server"></asp:Label>

<asp:label id="namelb" runat="server"></asp:label></td>

<asp:LinkButton ID="access" runat="server" CssClass="btn btn-info btn-xs" OnClick="access_Click" PostBackUrl="~/patientAccount.aspx"><span class="glyphicon glyphicon-edit"></span>Access</asp:LinkButton>


</asp:Content>
Posted
Updated 5-Nov-15 7:02am
v3
Comments
Suvendu Shekhar Giri 5-Nov-15 12:50pm    
Well, you still need to add more description to your question like
1. what kind modal popup are you using? JQuery/Ajax ModalPopupExtender?
2. do you have a update panel in that page.
3. sharing the relevant code (not all) presents a clear picture.
uglsa 5-Nov-15 13:04pm    
I am using ajax ModalPopupExtender, I used a panel.I have shared the code.Thank you

 
Share this answer
 
Comments
uglsa 5-Nov-15 21:31pm    
Thank you.I have solved my issue :)
Suvendu Shekhar Giri 5-Nov-15 22:40pm    
Glad that it helped :)
Hi,

The answer lies in your question. It is the default behavior of Model window/popup. From Wikipedia:

Quote:
In user interface design, a modal window is a graphical control element subordinate to an application's main window which creates a mode where the main window can't be used. The modal window is a child window that requires users to interact with it before it can return to operating the parent application, thus preventing the workflow on the application main window. Modal windows are often called heavy windows or modal dialogs because the window is often used to display a dialog box.


Wikipedia link: https://en.wikipedia.org/wiki/Modal_window[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900