任何人都可以帮我看看为什么这个代码会禁用所有行,即使条件只满足一次?
private void RollListGrid_RowLoaded(object sender, RowLoadedEventArgs e)
{
if (masterList[0].Rolls[0].IsActive = false)
e.Row.IsEnabled = false;
foreach (var roll in masterList.Where(s => s.StudentId == StudentID))
{
foreach (var v in roll.MasterEnrolmentStatusList.Values)
{
if (v != null)
EnrolmentStatus.Add(v.Value.ToString());
}
}
foreach (var status in EnrolmentStatus)
{
if (status == "Confirmed")
e.Row.IsEnabled = false;
}
}
答案 0 :(得分:0)
我已经设法通过以下代码实现了我所需要的。
foreach (var x in e.Row.Cells)
{
if (((GridViewCell)x).Value != null && ((GridViewCell)x).Value.ToString() == "Confirmed" && x.Column.UniqueName.IndexOf("5") != -1)
{
e.Row.IsEnabled = false;
break;
}
}