Hi,
jo*@jongianni.com wrote:
As is usually the case, just realised what the problem is straight
after posting. The form element has runat=server so all input controls
cause a postback so I changed the image button (input type=image)
element to a plain img element and attached an onclick javascript
handler and a cursor: hand; style to simulate an image button.
Many things are incorrect in your post.
- The fact that the form has runat=server is not the cause for your
problem. In fact, even without runat=server, the input type=image causes
a postback, it's just what it's made for (don't forget that these
elements were defined in a time when JavaScript didn't exist). You had
two ways to cause a postback: either click on a "submit" button, or
click on an image button, which is exactly what you did. Runat=server
simply makes the form available ("visible") to the server side code.
- Second, Images don't have a onclick event handler, at least not in the
standard HTML definition. To make an image "button", you use
<a href="#" onclick="..."><img ...></a>
Replace "..." with the appropriate code. Don't forget that your
application is loaded on all kind of clients, so using standards is
always a good idea.
- Using the "javascript
:" pseudo-protocol is only useful when you
execute JavaScript code in the URL bar of the browser. In all other
circumstances, it is not needed, and can even cause problems. So you
onclick code should be
onclick="window.open('<%Response.Write(Configurati onSettings.AppSettings["HelpURL"]);%>');return
false;"
I added return false to specify that the HREF part of the link must not
be executed.
- Embedding ASP.NET code in your HTML code is a bad idea. It's the old
way of doing things. You don't want this for many reasons. Instead, you
can use an ASP Hyperlink, for example, and specify the onclick in the
code behind.
HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering:
http://www.galasoft-LB.ch
Private/Malaysia:
http://mypage.bluewin.ch/lbugnion
Support children in Calcutta:
http://www.calcutta-espoir.ch