這是ASPX裡的代碼
復制代碼 代碼如下:
<asp:Repeater ID="OrderList" runat="server">
<ItemTemplate>
<%#this.info(Eval("id").ToString(), Eval("id").ToString())%>
</ItemTemplate>
</asp:Repeater>
下面是CS裡代碼
復制代碼 代碼如下:
protected void Page_Load(object sender, EventArgs e)
{
.......
}
protected string info(string id)
{
switch (num)
{
case "0":
returnStr = "ID為0";
break;
case "1":
returnStr = "ID為1";
break;
case "2":
returnStr = "ID為2";
break;
case "3":
returnStr = "ID為3";
break;
case "4":
returnStr = "ID為3";
break;
}
return returnStr;
}