Hello,
i'm trying to use related comboboxes.
At first glance everything seems to be fine.
But when i try to scroll to the end of Combo2 the combo flickers shortly and i have now duplicated entries in my Combo2.
The reason is that the "Combo2_ItemsRequested-event" is being called multiple times.
Does anybody have an explanation and a solution for this issue?
Thanks in advance!
here is my code
code on the server side
i'm trying to use related comboboxes.
At first glance everything seems to be fine.
But when i try to scroll to the end of Combo2 the combo flickers shortly and i have now duplicated entries in my Combo2.
The reason is that the "Combo2_ItemsRequested-event" is being called multiple times.
Does anybody have an explanation and a solution for this issue?
Thanks in advance!
here is my code
| <telerik:RadComboBox ID="Combo1" Runat="server" Height="22px" |
| Width="340px" MaxHeight="150px" |
| Filter="Contains" |
| ExpandDelay="50" HighlightTemplatedItems="True" |
| OnClientSelectedIndexChanging="LoadCombo2" |
| OnItemsRequested="Combo1_ItemsRequested" |
| </telerik:RadComboBox> |
| <telerik:RadComboBox ID="Combo2" Runat="server" |
| MaxHeight="150px" |
| OnClientItemsRequested="ItemsLoaded" |
| OnItemsRequested="Combo2_ItemsRequested" |
| style="z-index: 1; position: relative; width: 340px; display:table-cell; top: 0px; height: 21px; left: 0px;" |
| ShowWhileLoading="False"> |
| </telerik:RadComboBox> |
| <script type="text/javascript"> |
| var cboSecond; |
| function pageLoad() { |
| cboSecond = $find("Combo2"); |
| } |
| function LoadCombo2(combo, eventArqs) { |
| var item = eventArqs.get_item(); |
| Combo2.requestItems(item.get_value(), false); |
| } |
| function ItemsLoaded(combo, eventArqs) { |
| if (combo.get_items().get_count() > 0) { |
| combo.set_text(combo.get_items().getItem(0).get_text()); |
| combo.get_items().getItem(0).highlight(); |
| } |
| } |
| </script> |
code on the server side
| Protected Sub Combo2_ItemsRequested(ByVal o As Object, ByVal e As Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs) Handles Combo2.ItemsRequested |
| If IsNumeric(e.Text) Then |
| Dim id As Long = System.Convert.ToInt32(e.Text) |
| LoadCombo2(id) |
| End If |
| End Sub |
| Private Sub LoadCombo2(ByVal id As Long) |
| Dim sqlda As SqlDataAdapter |
| Dim sqltbl As New DataTable |
| Dim sSQLAffiliates As String |
| sSQLAffiliates = GetAffiliateSQL(id) |
| sqlda = New SqlDataAdapter(sSQLAffiliates, sqlconn) |
| sqlda.Fill(sqltbl) |
| With Me.Combo2 |
| .DataTextField = "Affiliate" |
| .DataValueField = "Affiliate_ID" |
| .DataSource = sqltbl |
| .DataBind() |
| End With |
| End Sub |