0

我想打开一个模式错误框,其中包含一条消息和一个按钮,Page_Load当传入Querystring不包含必需的属性或格式错误时,将用户从事件中重定向。

我已经定义了一个jQuery打开对话框的函数,但是当我尝试通过RegisterStartupScriptor注册它时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;
}

有人可以告诉我这是如何实现的吗?

4

0 回答 0