日期:2014-05-17 浏览次数:20396 次
protected void Data_g_ItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) { String A = DataBinder.Eval(e.Item.DataItem, "A").ToString(); String B = DataBinder.Eval(e.Item.DataItem, "B").ToString(); String C = DataBinder.Eval(e.Item.DataItem, "C").ToString(); TextBox TextBox1 = e.Item.FindControl("TextBox1") as TextBox; if (A == "1") TextBox1.ReadOnly = true; ImageButton B1 = e.Item.FindControl("B1") as ImageButton; ImageButton B2 = e.Item.FindControl("B2") as ImageButton; ImageButton B3 = e.Item.FindControl("B3") as ImageButton; ImageButton B4 = e.Item.FindControl("B4") as ImageButton; if (C == "1") { B3.Visible = false; B4.Visible = false; } else if (C == "2") { B1.Visible = false; B2.Visible = false; } } }