Introduction:
Here I will explain how to show jQuery ui modal popup from code behind or open jQuery modal popup from server side in asp.net using c#, vb.net.
Description:
In previous articles I explained Show alert message from code behind, jQuery show alert message while leaving from website, jQuery enable / disable controls on page, jQuery Countdown timer script example,jQuery Increase or Decrease font size of website and many articles relating to JQuery and asp.net. Now I will explain how to show jQuery ui modal popup from code behind or from server side in asp.net using c#,vb.net.
In previous articles I explained Show alert message from code behind, jQuery show alert message while leaving from website, jQuery enable / disable controls on page, jQuery Countdown timer script example,jQuery Increase or Decrease font size of website and many articles relating to JQuery and asp.net. Now I will explain how to show jQuery ui modal popup from code behind or from server side in asp.net using c#,vb.net.
To show modal popup from code behind we need to write the code like as shown below
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>jQuery Show Modal Popup from code behind or server side</title>
<link type="text/css" rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script type="text/javascript">
function showmodalpopup() {
$("#popupdiv").dialog({
title: "jQuery Popup from Server Side",
width: 430,
height: 250,
modal: true,
buttons: {
Close: function () {
$(this).dialog('close');
}
}
});
};
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<div id="popupdiv" title="Basic modal dialog" style="display: none">
<b> Welcome to Aspdotnet-Suresh.com</b>
</div>
<asp:Button ID="btnShowModal" runat="server" Text="Show Popup" OnClick="btnShowModal_Click" />
</div>
</form>
</body>
</html>
|
In code behind we need to write the code like as shown below
C# Code
|
VB.NET Code
|
Demo