views:

63

answers:

1

hi

i have data grid. now here i am checking the condition if Companyrows.count is zero . if count is zero make data grid.visible is false.

List<Employee> Companyrows = new List<Employee>();

 if (Companyrows.Count == 0)
            {
                dgrdRowDetail.Visibility = "Collapsed";
// getting error
 //  convert type 'string' to 'System.Windows.Visibility'   
            }
            else
            {
                dgrdRowDetail.ItemsSource = Companyrows;
            }

any help how to solve this issue would be great thank you

+3  A: 

"Collapsed" isn't it a string?

you have to declare the collapsed as following:

dgrdRowDetail.Visibility = Visibility.Collapsed;
Subhen