1.加入
/// 使用前需加入
/// <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
/// <script src="//code.jquery.com/jquery-1.10.2.js"></script>
/// <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
/// 因model屬性無法使用,所以加入block ui套件,但同時加入會造成block ui 擋住dialog ,故需調整index
html
javascript
function confirdialog(param1, param2, title, content,btnid) {
$.blockUI({ message:"", baseZ: -1, }); //如果用block ui 就必須調整階層位置
$("#dialog").dialog({
draggable: false,
title: title,
open: function () {
var markup = content;
$(this).html(markup);
},
buttons: [
{
text: param1,
click: function () {
$('#'+btnid).click();
}
},
{
text: param2,
click: function () {
$.unblockUI();
$(this).dialog('close');
}
}
],
zIndex: 999
}).prev().find(".ui-dialog-titlebar-close").hide();; //本行為隱藏dialog打叉按鍵
}
<body>
<div id="dialog" style="display:none" >
</div>
<asp:Button runat="server" ID="btnSubmitxt" OnClick="btnSubmitxt_Click" Text="自訂名稱" />
<asp:Button ID="Button1" runat="server" Text="Button" style = "display:none" OnClick="ConfirmAlert_Click" CausesValidation="false" />
</body>
cs.
ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "userControlCallClick", "confirdialog('" + actionText + "','" + closeText + "','" + title + "','" + content + "','" + Button1.ClientID + "')", true);
沒有留言:
張貼留言