I am trying to load jQuery dialog from code behind gridview rowcommand. Looks like javascript function is not firing from code behind.
.vb file
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
if I use alert in clientscript it is working fine. but JS function not working.
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>