Here's code that seems to work. Perhaps you could compare it against your
own?
Ken
Microsoft MVP [ASP.NET]
<%@ page language="VB" %>
<%@ import namespace="Syst em.Data" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<script runat="server">
Function DataSource() As ICollection
' Define channels data table
Dim dt As DataTable
' Create channels data table
dt = New DataTable
dt.Columns.Add( New DataColumn _
("ChannelId" , GetType(String) ))
dt.Columns.Add( New DataColumn _
("ChannelNam e", GetType(String) ))
' Add news channel data row
Dim dr As DataRow
dr = dt.NewRow
dr(0) = "News"
dr(1) = "Noticias"
dt.Rows.Add(dr)
dr = dt.NewRow
dr(0) = "Sports"
dr(1) = "Sports2"
dt.Rows.Add(dr)
' Return RSS channel dataview
Return New DataView(dt)
End Function
Protected Sub Page_Load _
(ByVal sender As Object, _
ByVal e As System.EventArg s)
If Not IsPostBack Then
Repeater1.DataS ource = DataSource()
Repeater1.DataB ind()
End If
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>DataSour ce and Repeater</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:repeater id="Repeater1" runat="server">
<itemtemplate >
<asp:label runat="server" id="lblNews">
<%#Eval("Channe lId")%>:<%#Eval ("ChannelName") %></asp:label><br
/>
</itemtemplate>
</asp:repeater>
</div>
</form>
</body>
</html>
"shapper" <md*****@gmail. comwrote in message
news:11******** **************@ m73g2000cwd.goo glegroups.com.. .
Hello,
I created a Repeater at runtime with an AccessDataSourc e.Everything
Works fine!
Now I need to use the same repeater but with a DataSource created in my
VB.Net code.
I created a DataView but the Repeater doesn't show anything!
I don't get any error so I have no idea what is going on.
This is my function which creates the datasource which in this moment
has only one record:
Function DataSource() As ICollection
' Define channels data table
Dim dt As DataTable
' Create channels data table
dt = New DataTable
dt.Columns.Add( New DataColumn("Cha nnelId", GetType(String) ))
dt.Columns.Add( New DataColumn("Cha nnelName", GetType(String) ))
' Add news channel data row
Dim dr As DataRow
dr = dt.NewRow
dr(0) = "News"
dr(1) = "Noticias"
dt.Rows.Add(dr)
' Return RSS channel dataview
DataSource = New DataView(dt)
End Function
Could someone please help me out?
Thanks,
Miguel