ARTICLE

Pop-ups in ASP.Net

Posted by Abhimanyu Kumar Vatsa Articles | ASP.NET using VB.NET June 15, 2010
This article will explain you, how to create pop-ups in ASP.Net web applications.
Download Files:
 
Reader Level:

Introduction

Pop-up ads or pop-ups are a form of online advertising on the World Wide Web intended to attract web traffic or capture email addresses. Pop-ups are generally new web browser windows to display advertisements. The pop-up window containing an advertisement is usually generated by JavaScript, but can be generated by other means as well.

Considerations

There are lots of points to be considered while working with pop-ups.

The syntax of the window.open method is given below:

window.open ("URL", "windowName", "[windowFeatures]")

URL: Which page to open. If external then use

http://www.google.com

If internal then use

foldername/filename.aspx

OR
filename.aspx

Window Name: Name of window.

Window features: It includes the different features like

Property Name Description
status The status bar at the bottom of the window.
toolbar The standard browser toolbar, with buttons such as Back and Forward.
location The location entry field where we enter the URL.
menubar The menu bar of the window.
directories The standard browser directory buttons.
resizable Allow/Disallow the user to resize the window.
scrollbars Enable the scrollbars if the document is bigger than the window.
height Specifies the height of the window in pixel.
width Specifies the width of the window in pixel.

Default.aspx page

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" 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>Pop-ups in ASP.Net</title>
</head>

<body onload="javascript: poponload()" onunload="javascript: onunload()">
    <form id="form1" runat="server">
    <div>
    <!-- Script Coding (can be anywhere in body)-->
    <script language="javascript">
    function poponload()
    {
    testwindow= window.open ("http://www.google.com", "mywindow", "location=1,status=1,scrollbars=1,width=400,height=400");
    }
    function onunload()
    {
    testwindow= window.open ("add1.aspx", "mywindow", "location=1,status=1,scrollbars=1,width=450,height=500");
    }
    </script>
    <!-- Script Coding Closing (can be anywhere in body)-->

    </div>

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

HAVE A HAPPY CODING!
 

Login to add your contents and source code to this article
share this article :
post comment
 
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
Become a Sponsor