views:

17

answers:

0

Hi Guys,

I'm having a problem with mutliple form buttons. I've got a DB table which lists all of my categories, these are placed into a form in the form of image-buttons. They all have the same name and their value is the ID from the Category's table. So I've got a form with a number of buttons;

<input type="image" value="<%= Html.Encode(Model.Categories.ElementAt(i).ID) %>" src="<%= ResolveUrl("~/Images/Btn_SelectGrey.gif") %>" name="CatID" />

My controller is defined by;

[AcceptVerbs(HttpVerbs.Post), Authorize]
public ActionResult CategorySelection(int CatID) { ... }

Now here's my problem, The controller accepts the CatID value when I'm using firefox, however, in IE i get the following error;

The parameters dictionary contains a null entry for parameter 'CatID' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult CategorySelection(Int32)' in 'SIProject.Controllers.ListingController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.

Why is this? I've tried changing the "int CatID" variable to a string and then converting to an Int32 but it just assigns a value of 0. Can't figure out why this is happening in IE. If anyone out there could suggest a fix I would be very greatful.

EDIT

This is what the generated form and button elements look like in the view;

<form action="/Advertise/CategorySelection" method="post">
    <input type="image" value="1" src="/Images/Btn_SelectGrey.gif" name="CatID" />
    <input type="image" value="2" src="/Images/Btn_SelectGrey.gif" name="CatID" />
    ...
</form>

Cheers,

Sheefy