2011-02-08 56 views
0

所以我想将我的页面上的不同表格和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> 

如何我想改变这个到用户控制,然后我将如何呈现此作为在前端的局部视图?

谢谢!

回答

0

想通了。只需将每个table元素放入其自己的.aspx文件中,在顶部导入相同的文件,然后将其渲染为部分视图。

相关问题