I have a RenderPartial that yellow screens IE at this line
int addLocations = Model.Options.OfType<myOrderRowOption>().Single().AdditionalLocationsCount;
error is: Exception Details: System.InvalidOperationException: Sequence contains no elements
FireFox renders it fine. How can a server-side error be influenced by which browser is being addressed? (this isn't a postback - it's happening on the first-time call to the view).
Followup:
Ok...so i cleaned up the code to make it a little more presentable and the error condition no longer existed. The basic gist of the PartialView is populating a form where the orderRow can hold 2 different types of inputs - a radio button group and possibly a textbox.
Originally i had 2 separate FOREACH loops to iterate thru all option and wrote out the radio buttons in the first and the textbox in the 2nd. (with a 'If OptionType' test inside each loop.
I changed that to 1 FOREACH loop and used the ELSE branch instead. That cleared the error condition but I'm still not seeing how server-side conditions could be influenced by the browser in a non-postback condition.
this code structure works - comments below detail the differences from the original error condition.
<div class="showOrderRow">
<%string isChecked = "";
foreach (var option in WebinarFacade.Instance.GetOptions(Model.Webinar))
{
isChecked = (int)Model.RegistrationType == option.ID ? "checked" : "";
var optionType = option.GetType();
if (optionType.Name == "Option")
{%>
<input type="radio" ... />
<%
}
// originally this foreach loop ended and a started
//a 2nd one with a test that would exlcude the radio buttons
//if (optionType.Name != "Option")
else
{//point of original error
int addLocations = Model.Options.OfType<myOrderRowOption>().Single().optionCount;
%>
<br />
<h5>
Additional Locations</h5>
<input type="text" value="<%=addLocations%>" );'
name="Count<%=Model.Order.ID %>"
<%
}
}
</div>