10778

ImageButton With Mouse Event Handlers Considered Not Well Formed

Question:

ASP.NET says that the following ImageButton server tag is not well formed:

<asp:TableCell VerticalAlign="Top"> <asp:ImageButton runat="server" ID="imgAdd" src="Images/add_plus_1.gif" onmouseout="this.src='Images/add_plus_1.gif'" onmouseover="this.src='Images/add_plus_2.gif'" onmousedown"this.src='Images/add_plus_3.gif'" CauseValidation="false" style="cursor: pointer" OnClientClick="Javascript:SL_AddBuilding()" /> </asp:TableCell>

I think all the mouse event attributes are legit, so I don't know what it's complaining about.

Answer1:

If you copied it verbatim from your code you are missing an equal sign:

onmousedown"this.src='Images/add_plus_3.gif'"

Answer2:

<asp:ImageButton runat="server" ID="imgAdd" src="Images/add_plus_1.gif" onmouseout="this.src='Images/add_plus_1.gif'" onmouseover="this.src='Images/add_plus_2.gif'" onmousedown="this.src='Images/add_plus_3.gif'" CauseValidation="false" style="cursor: pointer" OnClientClick="Javascript:SL_AddBuilding()" />

Recommend

  • Change font color and background in html on mouseover
  • how to show all item of a dropdown list in asp.net?
  • Adding links to an array with jquery
  • Loading jQuery qTip code dynamically
  • simulate a onclick with selenium python
  • Define height of select box
  • CSS Sprites don't work in IE[8/7/6]
  • Confusion in RegExp Reluctant quantifier? Java
  • How to use compare validator to compare the data between two dropdownlists values?
  • How to change display text in item template based on eval in gridview?
  • https in htaccess and order of rules (using Expression Engine)
  • Use preg_match to find if string contains script-tags
  • How to get a table cell value using jQuery
  • Small video playback
  • PostgreSQL 9.x - pg_read_binary_file & inserting files into bytea
  • Nodejs bluebird promise fails while processing image
  • ASP.NET RegularExpressionValidator, validate on a non-match?
  • Adding independent aspx/asmx pages into DotNetNuke
  • Passing information to server-side function in a Google Docs Add On
  • How to apply a custom handlers to only specific folder
  • Streaming screenshots over WebRTC as a video stream from iOS
  • Python ImageIO Gif Set Delay Between Frames
  • How to view images from protected folder with php?
  • Moving Android View and preventing onDraw to be called over and over again
  • Display images in Django
  • HTTP/2 streams vs HTTP/1.1 connections
  • Custom validator control occupying space even though display set to dynamic
  • Syntax for setting draggablecursor property in google maps api
  • Resize panoramic image to fixed size
  • Importing jscolor library in angular 2
  • GridView Sorting works once only
  • How to get icons for entities from eclipse?
  • How to delete a row from a dynamic generate table using jquery?
  • json Serialization in asp
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • How to stop GridView from loading again when I press back button?
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?