Hi There!
I have created a jQuery "confirm" type dialog which is called from a button click event in VB code behind. So far, so good. However, I now need to be able to do something (in VB) when the "OK" button is clicked by the user.
So, to put in context, I will have a page with some textbox controls to gather information, then the user clicks a "Submit" (asp:button) to save the information to an SQL table. When the user clicks the asp:button, the VB code behind launchs a nice jQuery "Are you sure?" - Ok/Cancel dialog box. If the user clicks "Cancel", nothing happens. Fine. However if the user clicks "Ok" then i need the VB OnClick event sub routine to then run the code to update the SQL table. Hope that's clear so far.
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="TheBigOne_OpenDialogFromVB.aspx.vb" Inherits="TheBigOne_OpenDialogFromVB" %>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery UI Dialog</title>
<link href="css/jquery-ui-1.10.2.custom.css" rel="stylesheet" />
<script src="js/jquery-1.9.1.js"></script>
<script src="js/jquery-ui-1.10.2.custom.js"></script>
<script type="text/javascript" src="js/apprise-1.5.full.js"></script>
<link rel="stylesheet" href="css/apprise.css" type="text/css" />
<link rel="stylesheet" href="/resources/demos/style.css" />
<script type="text/javascript">
$
(document).ready(function () {
$
("#myDialog").dialog({
autoOpen
: false,
resizable
: false,
width
: 400,
height
: 250,
modal
: false,
buttons
: {
"Ok": function () {
$
(this).dialog("close");
},
Cancel: function () {
$
(this).dialog("close");
}
}
});
});
//$('#yourPanel').dialog({
// //options
//}).parent().appendTo("form");
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:Button ID="btnOpenMe" runat="server" Text="Click Me to open Dialog box" />
<div id="myDialog" title="Alert!">
<p>Are you sure you want to save this record?</p>
</div>
</form>
</body>
Partial Class TheBigOne_OpenDialogFromVB
Inherits System.Web.UI.Page
Protected Sub btnOpenMe_Click(sender As Object, e As EventArgs) Handles btnOpenMe.Click
Page.ClientScript.RegisterStartupScript(Me.GetType(), "openDialog", "$(function(){$('#myDialog').dialog();$('#myDialog').dialog('open');});", True)
'If [button in dialog]="ok" then
'
Update the SQL table
'End If
End Sub
End Class
Any suggestions most appreciated.