Conditionally display DataGrid or DalaList content

  • Thread starter Thread starter Danny Ni
  • Start date Start date
D

Danny Ni

Hi,

Is there a way to selectively display content of a DataGrid or DataList?
Normally I bind them to datareader or datatable, and they will display all
the rows, what if I don't want to display some of the rows.
Please don't tell me get rid of the rows from datareader or datatable,
that's not the answer I am looking for.

TIA
 
Here is an untested idea:

Air code:

Private Sub dg_ItemDataBound(ByVal sender As System.Object, ByVal e As
DataGridItemEventArgs) Handles dg.ItemDataBound
If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType =
ListItemType.AlternatingItem Then
Dim oHyl1 As HyperLink = CType(e.Item.FindControl("hyl1"), HyperLink)
oHyl1.Visible=False
End If
End Sub
 
Back
Top