当我想在成功提交数据后调用它以显示成功消息时,模式弹出窗口中没有显示模式弹出窗口的原因是什么原因。但是只显示阴影而不是完整模态
以下是我的HTML代码
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Confirmation</h4>
</div>
<div class="modal-body ">
<label style="color: green">
Your data is saved successfully.
</label>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
调用模态的c#代码如下
ScriptManager.RegisterStartupScript(this,this.GetType(),&#34; Pop&#34;,&#34; $(&#39;#popup3&#39;)。modal(&#39; show&#39 ;);&#34;,true);
答案 0 :(得分:0)
试试这个
ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "clentscript", "$('#popup3').modal('show');", true);
或
this.RegisterStartupScript("clentscript", "<script>$('#popup3').modal('show');</script>");
答案 1 :(得分:0)
<asp:Button runat="server" Text="Open Modal" ID="button1" OnClick="button1_click"/>
<asp:UpdatePanel ID="updatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header"></div>
<div class="modal-body">
<asp:TextBox ID="txtBox" runat="server"></asp:TextBox>
</div>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
protected void button1_click(object sender, EventArgs e) {
txtBox.Text = "update text";
updatePanel1.Update();
ScriptManager.RegisterClientScriptBlock(updatePanel1, this.GetType(), "script", " $('#exampleModal').modal('show');", true);
}