fernandezf
asked on
Hiding a datagrid if it's empty
I use a datareader to populate a datagrid.
Sub BindGrid()
' and bind to the datalist control
Dim documents As New ASPNetPortal.UALDB()
myDataGrid.DataSource = documents.UALGetDocuments( pilotinfo)
myDataGrid.DataBind()
End Sub
I like to hide the hide the datagrid if it doesn't return any information, but I don't know how to do that.
Sub BindGrid()
' and bind to the datalist control
Dim documents As New ASPNetPortal.UALDB()
myDataGrid.DataSource = documents.UALGetDocuments(
myDataGrid.DataBind()
End Sub
I like to hide the hide the datagrid if it doesn't return any information, but I don't know how to do that.
I beleive you autogenerating the columns, if so
Try this
mydatagrid.columns(0).visi
he wants to hide the entire datagrid not a column
ASKER
How about if I still want to bind the datagrid with a datareader?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If ds.Tables.Count > 0 And ds.Tables(0).Rows.Count > 0 Then
lblNoResults.Visible = False
Else
lblNoResults.Visible = True
End If
Regards,
Aeros