Home > ASP.Net, Javascript, Jquery > Display JQuery Popup Window from Server Side

Display JQuery Popup Window from Server Side


Hi all,

try this example to Display JQuery Popup Window from Server Side (Code behind)


<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/jquery-ui.js" type="text/javascript"></script>
<link href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/themes/start/jquery-ui.css"
 rel="stylesheet" type="text/css" />
<script type="text/javascript">
 function ShowPopup(message) {
 $(function () {
 $("#dialog").html(message);
 $("#dialog").dialog({
 title: "jQuery Popup Window",
 buttons: {
 Close: function () {
 $(this).dialog('close');
 }
 },
 modal: true
 });
 });
 };
</script>
<div id="dialog" style="display: none">
</div>
<asp:Button ID="btnShowPopup" runat="server" Text="Show Popup" OnClick="btnShowPopup_Click" />

In code behind :


protected void btnShowPopup_Click(object sender, EventArgs e)
{
 string message = "Message from server side";
 ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowPopup('" + message + "');", true);
}

Hope this helps

Good Luck.

Advertisements
Categories: ASP.Net, Javascript, Jquery
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: