Resources » Code Snippets » ASP.NET WebForms

How to show popup window using asp.net


Posted Date: 25-May-2010  Last Updated:   Category: ASP.NET WebForms    
Author: Member Level: Gold    Points: 4


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 Resources:


Read related articles: Show popup    Modal dialog    Modal Popup    

Did you like this resource? Share it with your friends and show your love!

Responses to "How to show popup window using asp.net"
Author: Ultimaterengan    25 May 2010Member 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.



962-11356-WebSite4.rar
Author: anish    26 May 2010Member Level: Bronze   Points : 2
call pop up alert in button OnClientClick event



In head section of .aspx page Put this



Author: nilesh    11 Aug 2010Member 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: Ultimaterengan    12 Aug 2010Member Level: Gold   Points : 1
HI friend,
Post your question in forum section.you will get quick response.



Feedbacks      

Post Comment:




  • 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:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Submit Article     Return to Article Index

    Subscribe to Subscribers
    Active Members
    TodayLast 7 Daysmore...

    Awards & Gifts
    Talk to Webmaster Tony John
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India