【发布时间】:2011-06-23 15:50:45
【问题描述】:
所以我想将页面上的不同 table 和 div 元素更改为用户控件,这样我就可以将它们呈现为部分视图,而不是让前端变得非常混乱。
一个例子是这个表:
<table id="summaryInformation" class="resultsGrid" cellpadding="2" cellspacing="0">
<tr>
<td id="EffectiveDateLabel" class="resultsCell">
<%= Html.LabelFor(m => m.EffectiveDate) %>
</td>
<td id="EffectiveDateValue" class="alignRight">
<%= Model.EffectiveDate.Value.ToString(Chatham.Web.Data.Constants.Format.DateFormatString) %>
</td>
<td id ="NotionalLabel" class="resultsCell">
<%= Html.LabelFor(m => m.Notional) %>
</td>
<td id="NotionalValue" class="alignRight">
<span>
<%= Chatham.Enumerations.CurrencyHelper.GetFriendlyName((Chatham.Enumerations.Currency)Model.FloatingComponent.CurrencyID.Value) %>
</span>
<%= Model.Notional.Value.ToString(Chatham.Web.Data.Constants.Format.CurrencyCentsIncludedFormatString) %>
</td>
</tr>
<tr>
<td id="MaturityDateLabel" class="resultsCell">
<%= Html.LabelFor(m => m.MaturityDate) %>
</td>
<td id="MaturityDateValue" class="alignRight">
<%= Model.MaturityDate.Value.ToString(Chatham.Web.Data.Constants.Format.DateFormatString)%>
-
<%= Model.AmortizationComponent.MaturityBusinessDayConvention%>
</td>
<td id="Td3" class="resultsCell"> Holiday City</td>
<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>
<td>
</tr>
<tr >
<td id="TimeStampLabel" class="resultsCell">
Rate Time Stamp
</td>
<td id="Timestamp" class="alignRight">
<%= Model.StateBag.CurveDate.TimeStamp.ToString(Chatham.Web.Data.Constants.Format.DateTimeFormatString) %>
</td>
</tr>
</table>
如何将其更改为用户控件,然后如何将其呈现为前端的局部视图?
谢谢!
【问题讨论】:
标签: html asp.net-mvc-2 partial-views