I have a Repeater control with 2 columns - the data under the 1st
column are links whereas those in the 2nd column are just text.
<script runat="server">
Sub Page_Load(.......)
'populating the Repeater & binding the data to it
End Sub
Sub Item_Command(ByVal obj As Object, ByVal ea As
RepeaterCommandEventArgs)
'If (Page.IsPostBack) Then
' rptrUsers.DataBind()
'End If
End Sub
Sub Item_DataBound(ByVal obj As Object, ByVal ea As
RepeaterItemEventArgs)
Response.Write("Data Bound<hr>")
If (Page.IsPostBack) Then
rptrUsers.DataBind()
End If
End Sub
Sub Item_Created(ByVal obj As Object, ByVal ea As
RepeaterItemEventArgs)
Response.Write("Item Created<br>")
End Sub
</script>
<form runat="server">
<asp:Repeater ID="rptrUsers" OnItemCommand="Item_Command"
OnItemCreated="Item_Created" OnItemDataBound="Item_DataBound"
runat="server">
...................
...................
...................
</asp:Repeater>
</form>
Assuming that the Repeater gets populated with 5 rows, when I run the
above code for the first time, OnItemCreated & OnItemDataBound fires 7
times - once for the header, 5 times for the 5 rows & once for the
footer.
Note the code in the sub named Item_Command which is commented. If I
uncomment the 3 lines & then click a link in the Repeater, the
Repeater no longer gets displayed.
Why so?
Thanks,
Ron
Nathan Sokalski - 01 Mar 2008 22:08 GMT
The reason is because before performing the databinding, you must populate a
DataTable (or whatever you are using as your data source) and assign it to
the Repeater's DataSource property. simply calling the DataBind() method
will pretty much just be binding the Repeater to a DataSource with a value
of Nothing. Hopefully this helps.

Signature
Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansokalski.com/
>I have a Repeater control with 2 columns - the data under the 1st
> column are links whereas those in the 2nd column are just text.
[quoted text clipped - 49 lines]
>
> Ron