我有这一类:
public class RateResultsSummary
{
public RateResultsSummary(string labelText, string dataText)
{
LabelText = labelText;
DataText = dataText;
}
private string _labelText;
public string LabelText
{
get { return _labelText; }
set { _labelText = value; }
}
private string _dataText;
public string DataText
{
get { return _dataText; }
set { _dataText = value; }
}
}
页: 1
<body>
<form id="form1" runat="server">
<div>
<fieldset id="fsetSummaryLeastCostOption" runat="server" style="width: 200px;" visible="false">
<legend>SUMMARY LEAST COST OPTION</legend>
<asp:Repeater ID="repSummary" runat="server">
<ItemTemplate>
<asp:Label ID="lblLabel" runat="server"
Text= <%# ((RateResultsSummary)Container.DataItem).LabelText %> ></asp:Label>
<asp:Label ID="lblData" runat="server"
Text= <%# ((RateResultsSummary)Container.DataItem).DataText %> ></asp:Label>
<asp:Label ID="lbl" runat="server" Text="Some static text"></asp:Label>
<br />
</ItemTemplate>
</asp:Repeater>
</fieldset>
</div>
</form>
</body>
我以这种方式约束:
protected void Page_Load(object sender, EventArgs e)
{
List<RateResultsSummary> lstRateResultDataSource = new List<RateResultsSummary>();
lstRateResultDataSource.Add(new RateResultsSummary("Carrier: ", "Xxx"));
lstRateResultDataSource.Add(new RateResultsSummary("Mode: ", "Yyyy"));
lstRateResultDataSource.Add(new RateResultsSummary("Service: ", "Zzz"));
lstRateResultDataSource.Add(new RateResultsSummary("Transit: ", "Ccccc"));
lstRateResultDataSource.Add(new RateResultsSummary("Total Cost: ", "Kkkkk"));
repSummary.DataSource = lstRateResultDataSource;
repSummary.DataBind();
}
我只剩下一个空页。
我是否误解了什么?
增 编