我想打开一个按钮模式点击。模式可以用一个按钮,点击如何从后面的代码打开模态?
<asp:Button ID="Button4" runat="server" class="btn btn-info" data-toggle="modal" OnClientClick="return false;" data-target="#View1" Text="View Details" />
我需要在函数结束时打开此模式被打开,但我不知道如何做到这一点,从C#代码后面。我想:
protected void Button2_Click(object sender, EventArgs e)
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "ModalView", "<script>$('#View1').modal('show');</script>", false);
}
设计
<!-- modal 1 -->
<div class="modal fade" id="View1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" runat="server">
<div class="modal-dialog">
<div class="modal-content">
<div class="alert alert-success">
<strong>Well done!</strong> Successfully Saved
</div>
</div>
<!-- modal-content -->
</div>
<!-- modal-dialog -->
</div>
<!-- modal -->
你检查控制台?有没有错误?而'View1'不在你的代码片段中。 – VDWWD
我没有发现任何错误..!模型是可见的直接鼠标点击'button4'.I检查C#代码['button2]'与断点,没有错误,但它不工作..!我认为C#代码不正确。 – Kirk
我认为你的代码在你加载页面之前正在执行。 (),“this.GetType(),”ModalView“,” “,false);' –