我需要做什么来解决此问题?

问题描述 投票:0回答:1

嗨,我需要您的帮助。我使用此代码来调用模式并传递一些数据:

 protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int index = Convert.ToInt32(e.CommandArgument);
        if (e.CommandName.Equals("editRecord"))
        {

            GridViewRow gvrow = GridView1.Rows[index];
            HfUpdateID.Value = HttpUtility.HtmlDecode(gvrow.Cells[1].Text).ToString();
            txtNameUpdate.Text = HttpUtility.HtmlDecode(gvrow.Cells[2].Text);
          /*  txtEmailIDUpdate.Text = HttpUtility.HtmlDecode(gvrow.Cells[3].Text);
            txtAddressUpdate.Text = HttpUtility.HtmlDecode(gvrow.Cells[4].Text);
            txtContactUpdate.Text = HttpUtility.HtmlDecode(gvrow.Cells[5].Text);*/
            lblResult.Visible = false;
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append(@"<script type='text/javascript'>");
            sb.Append("$('#myModal').modal('show');");
            sb.Append(@"</script>");
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "EditModalScript", sb.ToString(), false);

        }

    }

我正在使用此版本的JQuery和Bootstrap:

 <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
 <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
 <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>

但是......我在控制台中遇到此问题。模态无法打开。

VM2312:1 Uncaught TypeError: $(...).modal is not a function
at <anonymous>:1:15
at Sys._ScriptLoader._loadScriptsInternal (MicrosoftAjaxWebForms.js:6)
at Sys._ScriptLoader._nextSession (MicrosoftAjaxWebForms.js:6)
at Sys._ScriptLoader._loadScriptsInternal (MicrosoftAjaxWebForms.js:6)
at Sys._ScriptLoader._nextSession (MicrosoftAjaxWebForms.js:6)
at Sys._ScriptLoader.loadScripts (MicrosoftAjaxWebForms.js:6)
at Sys.WebForms.PageRequestManager._onFormSubmitCompleted (MicrosoftAjaxWebForms.js:6)
at Array.<anonymous> (MicrosoftAjax.js:6)
at MicrosoftAjax.js:6
at Sys.Net.WebRequest.completed (MicrosoftAjax.js:6)
jquery asp.net bootstrap-modal
1个回答
0
投票
尝试在头文件末尾和jquery脚本之前添加bootstrap.min.js脚本
© www.soinside.com 2019 - 2024. All rights reserved.