Nov 02, 2010, 6:29 PM
[CLOSED] Manipulating ComboBox Items via DirectMethod
Hello,
I'm trying to manipulate the list of items in an Ext.Net Combobox, but it's not working as expected.
Here's a snippet:
On the other hand some similar logic that I have in the Init event of my page seems to work just fine:
I'm trying to manipulate the list of items in an Ext.Net Combobox, but it's not working as expected.
Here's a snippet:
<DirectMethod()> _
Public Sub UpdateList()
ddlMyDropdown.Items.Clear()
Dim myDict As IDictionary = PopulateDropDown()
If myDict.Count > 0 Then
For Each dictItem As DictionaryEntry In myDict
ddlMyDropdown.Items.Add(New Ext.Net.ListItem(dictItem.Value, dictItem.Key))
Next
ddlMyDropdown.SelectedItem.Value = "" 'Don't select anything
Else
ddlMyDropdown.Items.Add(New Ext.Net.ListItem("Nothing found!", "-1"))
ddlMyDropdown.SetValue("Nothing found!")
End If
End Sub
If I step through my code, I see the Items collection of ddlMyDropdown get cleared and I see items getting added to it, but I don't see the changed items reflected in the contents of ddlMyDropdown after my event has finished firing.On the other hand some similar logic that I have in the Init event of my page seems to work just fine:
Protected Sub My_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
If Not Ext.Net.X.IsAjaxRequest Then
Dim myDict As IDictionary = PopulateDropDown()
For Each dictItem As DictionaryEntry In myDict
ddlMyDropdown.Items.Add(New Ext.Net.ListItem(dictItem.Value, dictItem.Key))
Next
End If
End Sub
-Eric
Last edited by Daniil; Nov 02, 2010 at 7:23 PM.
Reason: [CLOSED]