【发布时间】:2014-03-29 05:42:52
【问题描述】:
我正在尝试从 gridview 行命令后面的代码加载 jQuery 对话框。看起来 javascript 函数没有从后面的代码中触发。
.vb 文件
Private Sub grdLoan_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles grdLoan.RowCommand
If e.CommandName = "pdf" Then
Dim message As String = "This is test message"
ClientScript.RegisterStartupScript(Me.GetType(), "Popup", "ShowPopup('" + message + "');", True)
'ScriptManager.RegisterClientScriptBlock(grdLoan, Me.[GetType](), "MyScript", "ShowPopup('" + message + "');", True)
End If
End Sub
如果我在客户端脚本中使用alert,它工作正常。但是 JS 函数不起作用。
ClientScript.RegisterStartupScript(Me.GetType(), "Popup", "alert("This is test message"", True)
html
<div id="dialog" style="display: none">
</div>
<script type="text/javascript">
function ShowPopup(message) {
alert(message);
$(function () {
$("#dialog").html(message);
$("#dialog").dialog({
title: "jQuery Dialog Popup",
buttons: {
Close: function () {
$(this).dialog('close');
}
},
modal: true
});
});
};
</script>
【问题讨论】:
标签: c# jquery asp.net jquery-ui jquery-ui-dialog