Wednesday, June 25, 2014

Show jQuery Modal Popup from Code behind (Server Side)


Here I will explain how to show 
jQuery ui modal popup from code behind or open jQuery modal popup from server side in using

In previous articles I explained Show alert message from code behindjQuery show alert message while leaving from website
jQuery enable / disable controls on pagejQuery Countdown timer script example,jQuery Increase or Decrease font size of website and many articles relating to JQuery and Now I will explain how to show jQuery ui modal popup from code behind or from server side in using c#,

To show modal popup from code behind we need to write the code like as shown below

<html xmlns="">
<title>jQuery Show Modal Popup from code behind or server side</title>
<link type="text/css" rel="stylesheet" href="" />
<script type="text/javascript" src=""></script>
<script type="text/javascript" src=""></script>
<script type="text/javascript">
function showmodalpopup() {
title: "jQuery Popup from Server Side",
width: 430,
height: 250,
modal: true,
buttons: {
Close: function () {
<form id="form1" runat="server">
<div id="popupdiv" title="Basic modal dialog" style="displaynone">
<b> Welcome to</b>
<asp:Button ID="btnShowModal" runat="server" Text="Show Popup" OnClick="btnShowModal_Click" />
In code behind we need to write the code like as shown below

C# Code

protected void btnShowModal_Click(object sender, EventArgs e)
ScriptManager.RegisterStartupScript(this, GetType(), "Show Modal Popup""showmodalpopup();"true);

Protected Sub btnShowModal_Click(ByVal sender As ObjectByVal e As EventArgs)
ScriptManager.RegisterStartupScript(Me, [GetType](), "Show Modal Popup""showmodalpopup();"True)
End Sub