
July 1st, 2009, 04:37 PM
|
 |
I do .NET for a living
|
|
Join Date: Sep 2003
Location: Florida
|
|
Quote: | Originally Posted by iis_guy Hi,
I have a repeater bound to a data source (XmlDataSource if that matters).
Problem is, there are a few items that I DO NOT want to appear in my repeater. The criteria is if the "name" field matches a subset of names ("cube", "square", "rombus", "triangle").
How can I filter based on these names? Which event should I use? I don't think DataBinding is the correct one. |
Make a dataview of the target data and apply a row filter.
Simple example:
Code:
Private Sub BindIt2()
Dim cnn As New SqlConnection(ConfigurationSettings.AppSettings.Ge t("KWPrismWebConnectionString").ToString)
Dim cmd As SqlCommand = cnn.CreateCommand
cmd.CommandType = CommandType.Text
cmd.CommandText = "Select top 15 * from [User] order by UserName"
Dim daUser As New SqlDataAdapter
Dim dsUser As New DataSet
Dim dv As New DataView
daUser.SelectCommand = cmd
daUser.Fill(dsUser, "Users")
With dv
.Table = dsUser.Tables("Users")
.RowFilter = "UserName IN ('100220rog','100220bill')"
End With
With DataList1
.DataSource = dv
.DataBind()
End With
cmd.Dispose()
End Sub
__________________
Roger (.NET MCP)
|