views:

2170

answers:

2

I've come across a strange problem with a ASP.net MVC project.

the following code works fine in Firefox, chrome, Safari IE8 - BUT not IE8 in IE7 Compatability mode

<%  Using Ajax.BeginForm("SetStatus", "StatusControl", New AjaxOptions With {.Confirm = "Are you sure you wish to change the Status?", .OnBegin = "Show_Updating", .OnComplete = "Hide_Updating"})%>
    <%=Html.Hidden("ItemID")%>
    <select id="SelectStatus" name="SelectStatus">
        <option selected="selected">Active</option>
        <option>Disable</option>
    </select>
    <input type="submit" value="OK" title="Set Status" class="small_button" />
<% End Using%>

When I set a break point in the SetStatus Method the Form Collection lists SelectStatus and ItemID. The SelectStatus resolves to "" instead of "Active" or "Disable" In all other browsers this resolves correctly!

Any idea's what's going on? I'm using IE-8 RC1.

Below is the SetStatus Control method

<AcceptVerbs(HttpVerbs.Post)> _
 Function SetStatus(ByVal form As FormCollection)
    Dim status = form("SelectStatus")

    Select Case status
        Case "Active"
            Dim ItemID As Integer = form("ItemID")
            Return Restore(ItemID)
        Case "Disable"
            Dim ItemID As Integer = form("ItemID")
            Return Disable(ItemID)
    End Select

    Return Content("Errors")
End Function
+2  A: 

Try setting an explict value for the option

<option value="Active" selected="selected">Active</option>
<option value="Disable">Disable</option>
tvanfosson
this worked thanks!
Harry
A: 

great! this works, but if I use Html.DropDownList("SelectStatus"), how can i Control the way that the select list renders? I need this because the select list is dynamically populated