0

Hi hi!

Just that, I want to hide a asp:button when a asp:dataview is empty and show it when it has records...

Any Ideas?

Omar

2
Contributors
3
Replies
5
Views
10 Years
Discussion Span
Last Post by ptaylor965
0

for Dataview use

If dataview.count = 0 then
button1.visible = False
else
button1.visible = True
End If

or
for datatables use

If datatable.rows.count = 0 then 
button1.visible = False
else
button1.visible = True
End If
0

Thanks for your reply ptaylor965, !!

Well, first of all, I made a mistake about the component, Its a gridview; second of all, on which event do I put these codes? consider that my gridview its binded by design with a objectdatasource, and I can't change that.

Thanks again!!

Omar

for Dataview use

If dataview.count = 0 then
button1.visible = False
else
button1.visible = True
End If

or
for datatables use

If datatable.rows.count = 0 then 
button1.visible = False
else
button1.visible = True
End If
0

For DataGrids use

If datagrid.rows.count = 0 then 
button1.visible = False
else
button1.visible = True
End If

I would place this code on form_load and on any buttons or events that fill/refresh the datagrid

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.