views:

256

answers:

2

I have a DetailsView and few buttons on my page.

So I want to hide them if DetailsView displays not a data but just a value if EmptyDataText property.

How can I do that?

I found only one way - view.Rows[0].Cells.Count == 1 because if the data is displayed, more then one columns presents. But I don't like such method.

+1  A: 

If there is empty data text only in the detailsview, In the first row there is text of empty data, we can compare it .........

 if (DetailsView1.Rows[0].Cells[0].Text == "your Empty Data text")
    {

    }
Muhammad Akhtar
DetailsView.EmptyDataText has a value from the markup
abatishchev
+1  A: 

Please try DetailView properties like DataItemIndex and DataItemCount

Ahmadreza
Sounds cool, but it's zero while DetailsView displays a data
abatishchev