Button OnClick事件未触发 [英] Button OnClick event is not fireing

查看:72
本文介绍了Button OnClick事件未触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的.aspx页面中有一个模式弹出窗口,其中包含一个表单。该表单中有一个提交按钮。我可以通过该表单将数据保存到数据库而没有任何问题。但是内容页面中的按钮(外部)单击该按钮时,弹出窗口不会触发。一旦模式弹出窗口被删除,该按钮正在工作。



我有检查元素 - 内容页面中的按钮(按钮名称 - 访问)的href显示为



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



我是asp.net的新手。请帮助



更新



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

<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>

推荐答案

MainContent
MainContent


access,,true,,,false,true))



I我是asp.net的新手。请帮助



更新



access", "", true, "", "", false, true))"

I am new to asp.net. Please help

update

<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
}
});
}
("#txt").autocomplete({ source: ds } }); }


这篇关于Button OnClick事件未触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆