For some reason thi开发者_如何学运维s code:
<td id="ddlHolidayCity" colspan="3">
<% for (int i = 0; i < Model.Trx.TransactionHolidayCityCollection.Count; i++)
{%>
<%=i > 0 ? "," : ""%>
<%=DropDownData.HolidayDays().ToList().Find(item => item.Value == Model.Trx.TransactionHolidayCityCollection[i].HolidayCityID.Value.ToString()).Text%>
<%}
%>
</td>
Is displaying cities like this:
New York , London
-- see the extra space before the comma? Where is that coming from???
It's probably coming from a newline or some other whitespace character just before escaping HTML to evaluate i
. Since it's inside the for
loop, it gets added to output. Try what happens if the spaces between angled brackets are removed:
<td id="ddlHolidayCity" colspan="3">
<% for (int i = 0; i < Model.Trx.TransactionHolidayCityCollection.Count; i++)
{%><%=i > 0 ? "," : ""%>
<%=DropDownData.HolidayDays().ToList().Find(item => item.Value == Model.Trx.TransactionHolidayCityCollection[i].HolidayCityID.Value.ToString()).Text%>
<%}
%>
</td>
To test this change the code to one line. Remove all spacing between your %> <% I bet it will fix it. See all the spacing below when I placed your code in a single line. Coldfusion had a directive to tell the renderer how to interpret code page white space.
<td id="ddlHolidayCity" colspan="3"> <% for (int i = 0; i < Model.Trx.TransactionHolidayCityCollection.Count; i++) {%> <%=i > 0 ? "," : ""%> <%=DropDownData.HolidayDays().ToList().Find(item => item.Value == Model.Trx.TransactionHolidayCityCollection[i].HolidayCityID.Value.ToString()).Text%> <%} %> </td>
精彩评论