views:

92

answers:

1

hello i am facing this stupid issue with no help any where. i am facing it in every form in my mvc2 project.

This is a input

<input type="image" src="<%=Url.Content("~/images/shopping-cart.jpg")%>" alt="shopping cart" id="btnshoppingCart" name="btnshoppingCart" value="shoppingCart" />

when i browse the page with firefox and click on the input Request.Params["btnshoppingCart"] != null or Request.Form["btnshoppingCart"] != null is statisfied.

When i browse the same page with internet explorer 8 and click on the same input Request.Params["btnshoppingCart"] != null or Request.Form["btnshoppingCart"] != null is not satisfied. When i used the watch i saw that there is no key by the name of "btnshoppingCart" in either Request.Form or Request.Params if input is clicked from internet explorer. However when it is clicked from firefox there is value "shoppingCart" inside Request.Form and Request.Params against "btnshoppingCart" key. One more strange thing that i observed was that are two keys "btnshoppingCart.x" and "btnshoppingCart.y" inside both Request.Form and Request.Params whenver clicking is done from both internet explorer and firefox. This is happening against all inputs of type image irrespective if the input is present inside a html form or not. Forms are created like this

<% using (Html.BeginForm("Action", "Controller", FormMethod.Post)) {%> The version of internet explorer is 8.0 and firefox is 3.6.6

A: 

It's a bug (feature? yeah right) of IE.

See: http://msdn.microsoft.com/en-us/library/ms535836%28VS.85%29.aspx

Specifically:

The x-coordinate is submitted under the name of the control with .x appended, and the y-coordinate is submitted under the name of the control with .y appended. Any value property is ignored. The src property specifies the img element.

Evan Trimboli
This is pretty stupid i hope it is a bug that some how passed thorugh. I have used the work around of appending the control name with .x. But it should not be like this.
Syed Salman Akbar