C# 如何从服务器端单击按钮打开模式弹出窗口 函数openModal(){ $('myModal').modal('show'); }; &时代; 标题 某物 关闭 拯救 受保护的void btnsupmit\u单击(对象发送者,事件参数e) { ScriptManager.RegisterStartupScript(this,this.GetType(),“Pop”,“openModal();”,true); }

C# 如何从服务器端单击按钮打开模式弹出窗口 函数openModal(){ $('myModal').modal('show'); }; &时代; 标题 某物 关闭 拯救 受保护的void btnsupmit\u单击(对象发送者,事件参数e) { ScriptManager.RegisterStartupScript(this,this.GetType(),“Pop”,“openModal();”,true); },c#,jquery,asp.net,twitter-bootstrap,C#,Jquery,Asp.net,Twitter Bootstrap,它给出了错误未捕获类型错误:$(…)。模态不是函数 是否已检查~/Site1.Master?也许您的母版页也包含jQuery库 是的。现在我从3.aspx页面删除了jquery库,现在它工作正常。非常感谢 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="3.aspx.cs" Inherits="KVTRANSAPORTS._3" MasterPageFile="~/Site1.Master" %> <asp:

它给出了错误未捕获类型错误:$(…)。模态不是函数


是否已检查~/Site1.Master?也许您的母版页也包含jQuery库


是的。现在我从3.aspx页面删除了jquery库,现在它工作正常。非常感谢
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="3.aspx.cs" Inherits="KVTRANSAPORTS._3" MasterPageFile="~/Site1.Master" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script src="Scripts/jquery-2.1.1.min.js"></script>
    <script src="Scripts/bootstrap.min.js"></script>
    <script type="text/javascript">
        function openModal() {
            $('#myModal').modal('show');
        };
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="container">
        <div class="btn-group">
            <asp:Button ID="btnSubmit" class="btn-info" runat="server" Text="Submit"
                OnClick="btnSubmit_Click"></asp:Button>
        </div>
        <div class="modal fade" id="myModal" tabindex="-1" role="dialog"
            aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close"
                            data-dismiss="modal" aria-hidden="true">
                            &times;
                        </button>
                        <h4 class="modal-title" id="myModalLabel">title
                        </h4>
                    </div>
                    <div class="modal-body">
                        something
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default"
                            data-dismiss="modal">
                            close
                        </button>
                        <button type="button" class="btn btn-primary">
                            save
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</asp:Content>

    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true);
    }