0

谁能帮我看看为什么即使条件只满足一次,这段代码也会禁用所有行?

    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;
        }
    }
4

1 回答 1

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;
            }
        }
于 2013-07-09T09:39:44.857 回答