这里是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; }
- 本文标题: Repeater等数据控件里如何根据需要判断显示值,如何使用switch
- 文章分类:【.NET/Web】
- 非特殊说明,本文版权归【胡同里的砖头】个人博客 所有,转载请注明出处.