Hi. I need to know how to handle InitializeDataSource events from dynamically generated WebCombo boxes inside a repeater so that I can use paging.
My VB looks something like this:
Private DataClasses As DataClassesDataContext Private EmpData As List(Of GetAllEmployeesResult) Protected Sub Page_Load(ByVal sender As Object, ByVal e As _ System.EventArgs) Handles Me.Load DataClasses = New DataClassesDataContext '***Set the repeater data source repeaterDisciplines.DataSource = DataClasses.GetAllDisciplines() repeaterDisciplines.DataBind() '***Set up the data source for the employee list EmpData = DataClasses.GetAllEmployees("").ToList() '***Reference all the webcombo boxes in the repeater to initialize them. For Each item As RepeaterItem In repeaterDisciplines.Items For Each ctl As Control In item.Controls() If TypeOf ctl Is Infragistics.WebUI.WebCombo.WebCombo Then Dim combo As Infragistics.WebUI.WebCombo.WebCombo = CType(ctl, Infragistics.WebUI.WebCombo.WebCombo) combo.DataSource = EmpData combo.EnableXmlHTTP = True combo.DropDownLayout.Pager.AllowPaging = True combo.DropDownLayout.Pager.PageSize = 20 'How do I handle the InitializeDataSource event here? End If Next Next End Sub
My ASP looks something like this:
<asp:UpdatePanel ID="upRepeater" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false"> <ContentTemplate> <asp:Repeater ID="repeaterDisciplines" runat="server" OnItemCommand="repeaterDisciplines_ItemCommand"> <ItemTemplate> <tr> <td class="tdLabel" style="text-align: left;"> <!--stuff--> </td> <td class="tdInput"> <igcmbo:WebCombo ID="WebCombo1" runat="server" > </igcmbo:WebCombo> </td> <td><!--stuff--></td> <td><!--stuff--></td> </tr> </ItemTemplate> </asp:Repeater> </ContentTemplate> </asp:UpdatePanel>
Thanks,
Dan Wahlstrom
Well, I figured out a way to handle the event by creating a new class that handles the InialiazeDataSource event
Public Class BetterComboBox Inherits Infragistics.WebUI.WebCombo.WebCombo Sub CreateComboBox() Handles Me.InitializeDataSource End SubEnd Class
But the combo boxes aren't being populated by data. Any ideas?
Well, now the problem is that if I use "BetterComboBox" controls instead of IG WebCombo controls, I can't catch them on pageload.
<igcmbo:WebCombo ID="WebCombo1" runat="server" > </igcmbo:WebCombo>
Needs to be
<BetterComboBox ID="WebCombo1" runat="server" > </BetterComboBox>
Which is out of my scope of knowledge. Any ideas?