tags:

views:

92

answers:

0

Hi,

Given a loop like this:

                <%  for (int valuationIndex = 0; valuationIndex < Model.CollectiveInvestment.Funds.Count; valuationIndex++) { 
                    FundValuation allocation = Model.CollectiveInvestment.Funds[valuationIndex]; 
                    int deletedIndex = valuationIndex;// (Model.IsDeleted(allocation) ? valuationIndex : -1); 
                    if (!Model.IsDeleted(allocation))
                        deletedIndex = -1;

This is pretty standard I think. Given the following:

                            <input type="text" id="del[<%=valuationIndex%>]" name="del[<%=valuationIndex%>]" value="<%=deletedIndex%>" />
                            <%=Html.TextBox(string.Format("deleted[{0}]", valuationIndex), deletedIndex) %>

The weird thing is that the manual input tag works perfectly giving the correct values. The Html.TextBox is always -1. This is weird, both should give the same value. I suspect that somehow the rendering of the value happens in a different order?

Thanks Regards Craig.