I want to open a new aspx page when a button pressed by the user that use the app.
until now I used Response.Redirect
but now I want that the previous page will stay in the background, and that the new popup will present only table data, without po开发者_Go百科stback.
Does it possible? thanks.
Does it have to be a button? If it's just a link then you can set its target
attribute to open the URL in a new window (or tab, it's up to the browser). Something like this:
<a href="popup.aspx" target="_blank">click here</a>
If it has to be a button, then you can open the new window with JavaScript.
But there's really no way for the server-side code to tell the browser to open a new window. It all has to translate on the client-side in the end because the browser is the part that's opening the window.
On a side note, for better UX you might want to consider using something like the jQuery UI Dialog instead of a pop-up. It's not only nicer from the user's perspective but I find that it's easier from a development perspective because it allows you to keep your pop-ups for a page on the page itself, so you don't have to worry about the exact issue you're facing now.
Essentially you'd load your pop-up's data (either on page load or by AJAX when it's called) into a hidden div
and just show that div
to the user when they click a button. The jQuery UI plugin just styles it nicely for you and handles modality and things like that.
Take a look at the ModalPopupExtender in the Ajax Toolkit. This will allow you to open a dialog on the page without a postback, and with the parent page in the background.
http://www.asp.net/ajaxlibrary/AjaxControlToolkitSampleSite/modalpopup/modalpopup.aspx
精彩评论