0
嗨,我有很多麻煩。我有一個引導模式,我試圖從ASP.net中的服務器端代碼(C#)打開。我看過其他文章,但我仍然在找麻煩。ScriptManager.RegisterClientScriptBlock不打開引導模式
aspx.cs頁面
private void message(){
ModalBody.Text = "You have reached your credit limit";
ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(),"myModal","$('#myModal').modal('show');", true);
upModal.Update();
}
ASPX頁面
<div class="modal fade" id="myModal" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog">
<asp:UpdatePanel ID="upModal" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">xxxxxx</h4>
</div>
<div class="modal-body">
<asp:Label ID="ModalBody" runat="server" Text=""></asp:Label>
<br />
<br />
<asp:Label ID="ModalBody2" runat="server" Text=""></asp:Label>
</div>
<div class="modal-footer">
<button class="btn btn-info" data-dismiss="modal" aria-hidden="true">Close</button>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
我注意到,當我移動
ModalBody.Text = "You have reached your credit limit";
ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(),"myModal","$('#myModal').modal('show');", true);
upModal.Update();
本節進入Page_Load方法,它工作正常,並彈出與文本一起顯示。我甚至跨過了一步,但它並沒有做太多甚至看到了控制檯。
謝謝
是的,已經被添加到所有的網頁,每個網頁都正常工作,但這一個。 – badman123