ASP.NET Button with Javascript

S

SQL

Hi all,

Can I use "window.open('mypage.aspx')" in the onclick method of an asp.net
button, or do I have to use input and place form tags around it?

Thanks.
 
Q

q

This works just fine:
<INPUT style="Z-INDEX: 105; LEFT: 45px; POSITION: absolute; TOP: 515px"
type="button" value="For TestTarget" id="btnTestTarget"
onclick="window.open('TestTarget.aspx')">
 
R

Robert Koritnik

Yes you can. The question is why use server control and waste mem resources
and processor time...
You can always add Attributes.Add("onclick", "…") to a server control.
 

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
474,141
Messages
2,570,813
Members
47,357
Latest member
sitele8746

Latest Threads

Top