Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I have a webform that I created, and I would like to use one of the buttons to launch a "pop-up" form and not redirect the user to a new page or tab. How can I do this?

I have this for my button
<asp:Button ID="btn_AddDistrict" runat="server" Text="Add District" Visible="false"/>

I am trying to figure out the onclick event to point this to.
:confused:
Posted
Updated 8-Mar-11 7:41am
v2

Sorry, I don't have a lot of time to answer this, but I would look into a modalPopup. Modal Popup Demo. It pops up a window on your web page and you can grey out the background as they work in it. Once they click done it ungreys the background and the page looks as it did before they clicked the button. If that isn't what you want you could hide/unhide a div with your form contents in it. Have the button hide/unhide the div when someone clicks on it.

If these ideas don't help please let me know and I will see if I can offer a better solution. Best of luck!
 
Share this answer
 
Comments
fjdiewornncalwe 8-Mar-11 16:19pm    
+5. My vote for a good way to do this.
JTobey 8-Mar-11 16:21pm    
Thanks I am going to give this a go.
GregWyatt 8-Mar-11 16:25pm    
If you run into any issues let me know, I used this on a website I created and maintain. There are also a few tricks to use if you want to do "special" stuff with it.
JTobey 8-Mar-11 17:18pm    
I know I have to do a lot of reading since I am new to Ajax, but here is my goal...
1. click my button and have a form load with the modalPopup
2. enter data into the form and save to the db
3. close the modalPopup

I can do #2, I am just need a push in the right direction on how to get moving with the Ajax...I have the component loaded into my project so I am getting somewhere. I just need to figure out how to use <ajaxtoolkit:modalpopupextender> and where to place it, etc.

any help at any time would be great.
JTobey 8-Mar-11 18:08pm    
Actually found a great web demo to help...thanks I think I am on my way!
http://www.asp.net/ajax/videos/how-do-i-use-the-aspnet-ajax-modalpopup-extender-control
 
Share this answer
 
v2
<a href="http://forums.asp.net/t/883647.aspx/1/10?Open+a+popup+window+after+a+button+click">Click for pop-up windows</a><br />
I hope this will help you.
 
Share this answer
 
Comments
fjdiewornncalwe 8-Mar-11 16:19pm    
If you actually read the whole thread you link to you would see that this is not a very good way to do this.
JTobey 8-Mar-11 16:21pm    
I guess my use of pop-up was incorrect, I am going to try the modalPopup in AJAX to do this as suggested above.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900