How to show popup window using asp.net


How to show popup window using asp.net

This is very simple project.if you want to show centered pop up window means,just see the below example.
In ASPX File


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript">

function popup(url)
{
var width = 300;
var height = 200;
var left = (screen.width - width)/2;
var top = (screen.height - height)/2;
var params = 'width='+width+', height='+height;
params += ', top='+top+', left='+left;
params += ', directories=no';
params += ', location=no';
params += ', menubar=no';
params += ', resizable=no';
params += ', scrollbars=no';
params += ', status=no';
params += ', toolbar=no';
newwin=window.open(url,'windowname5', params);
if (window.focus) {newwin.focus()}
return false;
}

</script>
</head>
<body>
<form id="form1" runat="server">
<div>


<a href="javascript: void(0)" onclick="popup('XMLFile.xml')">Centered popup window</a>

</div>
</form>
</body>
</html>



XML File:-

<?xml version="1.0" encoding="utf-8" ?>
<Employee>
<UserName>
rengan
</UserName>
<Password>
rengan
</Password>
<Experience>
2.5
</Experience>
<Department>
Technical
</Department>
</Employee>



Related Articles

More articles: Show popup Modal dialog Modal Popup

Comments

Author: Ultimaterengan25 May 2010 Member Level: Gold   Points : 1

This is very simple project.if you want to show centered pop up window means,just download the below project and run it.Some times we need to show information with in pop up window in that time we will use this project code.

Author: anish26 May 2010 Member Level: Bronze   Points : 2

call pop up alert in button OnClientClick event



In head section of .aspx page Put this

Author: nilesh11 Aug 2010 Member Level: Bronze   Points : 2

hey i m new at using js in C#.net
can any one tell me how to call js function in c# file.
but function in js file is defined as followed:
function_name : function()
{

code.....

}

when i try it to call with scriptmanager it gives me error that function is not defined.

plz its urjent..
can any one plz help me????

Author: Ultimaterengan12 Aug 2010 Member Level: Gold   Points : 1

HI friend,
Post your question in forum section.you will get quick response.



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: