MichaelPattit
New Member
Hi Guys.<BR><BR>I have a DropDownList in a repeater, and I want to dataBind to it a DataView. Since the regular DataBinding can't work on it in the Page_Load sub (because the control does not exist while loading), I'm doing it in the ItemCreated event of the Repeater, this way:<BR><BR>=================================<BR><asp:repeater<BR> ID="rptUser"<BR> runat="server" <BR> onItemCreated="f_itemCreated"><BR>=========================================<BR>And the f_itemCreated Sub:<BR>=========================================<BR>Sub f_itemCreated(Sender As Object, e As RepeaterItemEventArgs)<BR><BR> Dim drlGroup as DropDownList<BR><BR> drlGroup=e.item.findControl("drlGroup")<BR> drlGroup.dataSource=dvwGroups<BR> drlGroup.dataTextField="group_name"<BR> drlGroup.dataValueField="group_id"<BR> drlGroup.dataBind()<BR><BR>End Sub<BR>=============================================<BR>(The dvwGroups is created in the Page_Load DataView).<BR><BR>This is working well, and my question is: Is this the right way to do that, or maybe there is a better one?