Outside Computers

Monday, September 5, 2011

ASP.net Popup Window

On this post, i will give you a code snippet on how you can have a small popup window in your web application using asp.net

first what is a popup window, a popup window is just a small browser that shows some detailed information and often times ads, generally this new browser window is used for advertisements.

with us developers we can use this small popup for showing and minimizing file size, and even the whole page size, for showing what we need to tell the users.

basically popup window code is done through java script using
this code

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

and since I am using c# in asp.net I use this code for the popup window

LinkButton1.Attributes.Add("onclick","window.open('Users.aspx','','height=300,width=300');return false");
on this code snippet , I have used a link button to open a new popup window, just put this on the page_load() event, and no need to have an event for LinkButton1_click().

i hope this helps, this is useful when you want to show a little information that needs less design and coding.



On my next post I will tell you how to pass values in different web pages, since web application is different in windows application. If you have suggestions and comment you can post it here. Thanks.