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

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

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

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.