I'm working on a website which has the following code in an ascx page:
<%Using (Html.BeginForm("MakeABooking", "User", FormMethod.Post))%>
<button type="submit" class="searchCarButton JQryStyleButton" name="btnSubmit" value="1; <%:DataBinder.Eval(c.DataItem, "currentAsset.AssetID").ToString %>; <%:DataBinder.Eval(c.DataItem, "SearchForDate").ToString %>">Make Booking</button>
<%End Using%>
This form calls the MakeABooking Function in a ViewController:
<HttpPost()> _
<ValidateInput(False)> _
Public Function MakeABooking(btnSubmit As String) As ActionResult
Dim sMan As String = btnSubmit
Dim sSegmentBooked As String = sMan.Substring(0, sMan.IndexOf(";"))
sMan = sMan.Substring(sMan.IndexOf(";") + 1)
Dim sAsseID As String = sMan.Substring(0, sMan.IndexOf(";"))
Dim sDateBook As String = sMan.Substring(sMan.IndexOf(";") + 1)
Dim BookingModel As New BookingViewModel(CInt(sAsseID), CInt(sSegmentBooked), CDate(sDateBook))
Return View("MakeABooking", BookingModel)
End Function
When using Internet Explorer 8 with Compatibility View turned on, I get the following error Length cannot be less than zero. Parameter name: length.
However, when Compatibility View is turned off, it works fine but this causes another issue on the website I'm working on where ui-selector controls are not working properly (jQuery control).
The client whom we have created this website for is using Windows XP and Internet Explorer 8, hence needing to fix problem for Internet Explorer 8, as they are not willing to use another browser like Google Chrome or Firefox in which our website works fine on.
I've managed to replicate the problem using Windows 7 IE 9 with Compatibility mode on, and the string value passed in to the MakeABooking Function i.e. btnSubmit, is "<SPAN class=ui-button-text>Make Booking</SPAN>
" whereas the string passed should be something like this "1;8463;12/09/2012 12:00:00 AM", as the Function MakeABooking is looking for semi-colons, hence that error I'm getting. Does anyone know why I get the string "<SPAN class=ui-button-text>Make Booking</SPAN>
" instead of what I expect as mentioned earlier?
If I can get any assistance, it will be much appreciated.
Thanks hagensoft, adding in the following extra code to the right aspx page fixed the problem.
<asp:Content ID="Meta" ContentPlaceHolderID="MetaContent" runat="server">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
</asp:Content>
I also needed to add the following line of code in the Site.Master page in the tag.
<asp:ContentPlaceHolder ID="MetaContent" runat="server" />