protected void rptPL_ItemDataBound(object sender, RepeaterItemEventArgs e) { DataRowView drv = e.Item.DataItem as DataRowView; if (drv == null) { return; } POLineStatus status = Cast.Enum <POLineStatus>(drv["LineStatus"]); Label lblStatus = e.Item.FindControl("lblLineStatus") as Label; lblStatus.Text = POLine.POLineStatusText(status); HtmlInputCheckBox chk; switch (status) { case POLineStatus.Open: lblStatus.ForeColor = System.Drawing.Color.Blue; break; case POLineStatus.Close: lblStatus.ForeColor = System.Drawing.Color.Black; chk = e.Item.FindControl("checkbox") as HtmlInputCheckBox; chk.Visible = false; break; case POLineStatus.Cancel: lblStatus.ForeColor = System.Drawing.Color.Gray; break; } }
public static string POLineStatusText(POLineStatus statusValue) { switch (statusValue) { case POLineStatus.Open: return "有效"; case POLineStatus.Cancel: return "取消"; case POLineStatus.Close: return "已完成"; } return ""; }
public static string POLineStatusText(POLineStatus statusValue) { switch (statusValue) { case POLineStatus.Open: return("有效"); case POLineStatus.Cancel: return("取消"); case POLineStatus.Close: return("已完成"); } return(""); }