I have this class:
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; }
}
}
My .aspx page contains:
<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>
And I bind it in such a way:
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();
}
And I get an empty page only.
Do I miss something?
Thanks
You miss the
visible="false"
in third line on ...fieldset id="fsetSummaryLeastCostOption"...
精彩评论