0

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.

abatishchev
  • 98,240
  • 88
  • 296
  • 433

3 Answers3

2

Please try DetailView properties like DataItemIndex and DataItemCount

Ahmadreza
  • 564
  • 2
  • 6
  • 17
1

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
  • 51,913
  • 37
  • 138
  • 191
0

I realize this is super old, but this may help others:

    <EmptyDataTemplate>
        <style>
            .thingsiwanthidden {
                display: none;
            }
        </style>
    </EmptyDataTemplate>
DevBodin
  • 163
  • 7