Nate1
03-29-2008, 09:27 PM
I can't get the data out of this data table, when I do response.write its all there but I can't access the rows from the repeater, never had this problem before
Get the data on parent repeater databound
Dim rpt As Repeater = e.Item.FindControl("rptDates")
If Not rpt Is Nothing Then
'rpt.DataSource = GetDates()
Dim dt As New DataTable
dt.Columns.Add("Period")
dt.Columns.Add("DateStart")
dt.Columns.Add("DateEnd")
dt.Columns.Add("Available")
Dim Datestart As New DateTime
Dim DateEnd As New DateTime
For I As Integer = 1 To 6
GetWikiADPeriodDates(I, Datestart, DateEnd)
Dim dr = dt.NewRow
dr.Item("Period") = I
'Response.Write(Datestart & DateEnd & " " & I.ToString & " <br />")
'need to get the start and end periods
dr.Item("DateStart") = Datestart
dr.Item("DateEnd") = DateEnd
dr.Item("Available") = True
dt.Rows.Add(dr)
Next
rpt.DataSource = dt
rpt.DataBind()
End If
then try and Display it
<asp:Repeater ID="rptDates" runat="server">
<ItemTemplate>
<tr <%#alternatingrowstyle() %>><td colspan="6">
<%#DataBinder.Eval(Container, "Period")%>
<%#GetWikiInformation(DirectCast(DataBinder.GetDataItem(Container), Data.DataRowView))%>
</td></tr>
</ItemTemplate>
</asp:Repeater>
It prints an Error with this code, but the best Ive had other than that is a printout of the data type ie system.data.datarowview,
how do I access this data
Get the data on parent repeater databound
Dim rpt As Repeater = e.Item.FindControl("rptDates")
If Not rpt Is Nothing Then
'rpt.DataSource = GetDates()
Dim dt As New DataTable
dt.Columns.Add("Period")
dt.Columns.Add("DateStart")
dt.Columns.Add("DateEnd")
dt.Columns.Add("Available")
Dim Datestart As New DateTime
Dim DateEnd As New DateTime
For I As Integer = 1 To 6
GetWikiADPeriodDates(I, Datestart, DateEnd)
Dim dr = dt.NewRow
dr.Item("Period") = I
'Response.Write(Datestart & DateEnd & " " & I.ToString & " <br />")
'need to get the start and end periods
dr.Item("DateStart") = Datestart
dr.Item("DateEnd") = DateEnd
dr.Item("Available") = True
dt.Rows.Add(dr)
Next
rpt.DataSource = dt
rpt.DataBind()
End If
then try and Display it
<asp:Repeater ID="rptDates" runat="server">
<ItemTemplate>
<tr <%#alternatingrowstyle() %>><td colspan="6">
<%#DataBinder.Eval(Container, "Period")%>
<%#GetWikiInformation(DirectCast(DataBinder.GetDataItem(Container), Data.DataRowView))%>
</td></tr>
</ItemTemplate>
</asp:Repeater>
It prints an Error with this code, but the best Ive had other than that is a printout of the data type ie system.data.datarowview,
how do I access this data