Page_Load
着信Querystring
に必要な属性が含まれていない場合、または形式が正しくない場合に、メッセージとイベントからユーザーをリダイレクトするボタンを含むモーダルエラーボックスを開きたいのですが。
ダイアログを開くための関数を定義しましたが、またはjQuery
を介して登録しようとすると、表示されません。RegisterStartupScript
RegisterClientScriptBlock
function showErrorPopup() {
$('#errorDialog').dialog({
autoOpen: false,
height: 120,
width: 500,
draggable: false,
resizable: false,
modal: true,
title: "Error!",
open: function (type, data) {
$(this).parent().appendTo("form");
},
close: function (type, data) {
$('#addNoteButton').hide();
}
});
$('#errorDialog').dialog("open");
$('#addNoteButton').hide();
}
そしてPage_Load
:
string cID = Page.Request["c"];
int contractID = 0;
if (cID != null)
{
try
{
contractID = Convert.ToInt32(cID);
Contract contract = FacadeFactory.ProjectsFacade.GetContract(contractID);
TFSContract source = TFS.GetTFSContract(contract);
Contract = source;
}
catch (Exception)
{
errMessage.Text = "Zakázka s tímto číslem neexistuje!";
ScriptManager.RegisterClientScriptBlock(this, typeof(Page), UniqueID, script, true);
return;
}
}
else
{
errMessage.Text = "Zakázka s tímto číslem neexistuje!";
ScriptManager.RegisterClientScriptBlock(this.Page, typeof(Page), this.UniqueID, script, true);
return;
}
誰かがこれをどのように達成できるか教えてもらえますか?