C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » .NET Framework »

Popup windows in ASP.NET using C#


Posted Date: 26 May 2005    Resource Type: Articles    Category: .NET Framework
Author: NetspiderMember Level: Silver    
Rating: 1 out of 5Points: 10



Introduction



This code is helpful for opening Popup window in ASP.NET using c#

Paragraph Heading 1



//*** Place this on the Page_Load Event in Asp.net)****//

OpenPopUp(HelpBtn, "txt.aspx", "Help", 650, 450);


Paragraph Heading N


//******** This is a Separate function*******//


public static void OpenPopUp (System.Web.UI.WebControls.WebControl opener, string PagePath)
{
string clientScript;

//***Building the client script- window.open***//
clientScript = "window.open(\'" + PagePath + "\')";
//***regiter the script to the clientside click event of the 'opener' control**//
opener.Attributes.Add("onClick", clientScript);
}

public static void OpenPopUp (System.Web.UI.WebControls.WebControl opener, string PagePath, string windowName, int width, int height)
{
string clientScript;
string windowAttribs;

//Building Client side window attributes with width and height.//
//Also the the window will be positioned to the middle of the screen//
windowAttribs = "width=" + width + "px," + "height=" + height + "px," + "left=\'+((screen.width -" + width + ") / 2)+\'," + "top=\'+ (screen.height - " + height + ")/ 2+\'";


//***Building the client script- window.open, with additional parameters***///
clientScript = "window.open(\'" + PagePath + "\',\'" + windowName + "\',\'" + windowAttribs + "\');return false;";
//regiter the script to the clientside click event of the 'opener' control*****///
opener.Attributes.Add("onClick", clientScript);
}

Summary



This code is helpful for those Programmers whose have less knowlegde about HTML..



Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Retrieving C# primitive datatypes programmatically
Previous Resource: Export Sql Table to Excel for Windows Application
Return to Discussion Resource Index
Post New Resource
Category: .NET Framework


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use