Buttons Opens a new window

  • Thread starter netnews.comcast.net
  • Start date
N

netnews.comcast.net

I am wondering what the best way to have a button on a webform open in a new
browser window. I have a webform with a ComponentOne report on it, and I
want to export to excel, but when they click the export button I want it to
open in a new window. I know I could do it in client side javaacsript, and
pass in all the appropriate parameters, but it seems like there should be a
better way. Any ideas?

Thanks,
Mark Richards
 
H

Hermit Dave

to open a new window you will have to resort to javascript if you want to
use button... (that to htmlcontrol)

you other option is Hyperlink but that translates to <a href=""> on client..
you can set the url to go using naviateurl and the target like open in a new
window etc...

hth
 
J

Jeffrey Tan[MSFT]

Hi Mark,

Thanks for posting in this group.
Actually, the .Net asp.net mechanism only encapsulates the client side html
code and javascript. So all the works will be eventually get done throught
javascript code or html tag.
For your open a new window issue, .Net class library does not encapsulate a
way to open a new window, so I think you need refer to window.open
javascript method.
If you want to get this done at server side runtime, I think you can use
Page.RegisterClientScriptBlock method to register your window.open script
into client side.

If you have anything unclear, please feel free to tell me.

Have a nice day!

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
N

netnews.comcast.net

Thanks Jeffery,

That is really something that ought to be added to the framework, put a
"target" parameter on hyperlinks and buttons.

Mark
 
J

Jeffrey Tan[MSFT]

Hi Mark,

Thanks for your feedback.
For HyperLink Control, it will be rendered as <a> tag, you will find that
there is a Target field in this class.
While for buttons, its mainly usage is not for openning a web page(Although
you can add this function in its event through register client javascript
code for the button's click event), so the button classes do not have the
Target parameter.
I hope this makes sense to you, if you still have any concern, please feel
free to tell me.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,739
Latest member
Clint8040

Latest Threads

Top