Popup window in ASP.NET

This following code will explain how to create popup window using ASP.NET
Create two webforms
Place a button in first webform and in the Page_Load of the first form write the following code.


//onclick attribute which denotes the client side script to be called
//window.open() is a method in the javascript which is used to open a
//new window,you can specify the width and height of the popup window.
//popup.aspx denotes the webform to be openend, you can specify your own url to be opened

protected void Page_Load(object sender, EventArgs e)
{
btnpop.Attributes.Add("onclick", "window.open('popup.aspx','','height=100,width=200');return false");
}

Regards,
Dharma


Comments

Author: Abhinav Misra14 Dec 2008 Member Level: Silver   Points : 1

thanks for this

as far as im getting it
btnpop.Attributes.Add ->is for adding custom attribute in menefest
for btnpop.

Author: Pradeep Iyer18 Dec 2008 Member Level: Gold   Points : 0

Hi,

Thank for that.

It was a useful one.

Regards,
Pradeep Y

Author: Deepika Haridas18 Dec 2008 Member Level: Gold   Points : 1

Hi,
Good one..
Thanks for posting it.
Keep going on..

Regards,
Deepika



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