class ModContext
{
public ModContext(int first, int second)
{
this.First = first;
this.Second = second;
this.Result = this.First % this.Second;
}
public int First { get; private set; }
public int Second { get; private set; }
public int Result { get; private set; }
}
IList<ModContext> items = new List<ModContext>
{
new ModContext(10, 20),
new ModContext(30, 40)
};
this.repeater.DataSource = items;
this.repeater.DataBind();
ASPX:
<asp:Repeater id="repeater" runat="server">
<HeaderTemplate>
<div>
</HeaderTemplate>
<ItemTemplate>
<span><%# DataBinder.Eval(Container.DataItem, "Result") %></span>
<span><%# DataBinder.Eval(Container.DataItem, "First") %></span>
<span><%# DataBinder.Eval(Container.DataItem, "Second") %></span>
</ItemTemplate>
<FooterTemplate>
</div>
</FooterTemplate>
</asp:Repeater>
來源
2012-02-15 15:50:20
sll
什麼是Mod操作,顯示C#代碼 – sll 2012-02-15 15:40:49
你嘗試過什麼嗎? – 2012-02-15 15:41:19
Mod operator =% – 2012-02-15 15:41:59