[CLOSED] Manipulating ComboBox Items via DirectMethod

  1. #1

    [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:

        <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]
  2. #2
    Hi,

    Please use [CODE ] tags for any code.

    Please see #2 here
    http://forums.ext.net/showthread.php?10277-Requesting-feedback-on-the-new-Ext.NET-Pro-license
  3. #3
    Hi,

    Please see
    https://examples1.ext.net/#/Form/Com...Items_Actions/

    If you need to rebind all data via Items collection then use the following code after Items modification
    ddlMyDropdown.GetStore().DataBind();
  4. #4
    Quote Originally Posted by Daniil View Post
    Hi,

    Please use [CODE ] tags for any code.

    Please see #2 here
    http://forums.ext.net/showthread.php?10277-Requesting-feedback-on-the-new-Ext.NET-Pro-license
    Added [CODE] tags.
  5. #5
    Quote Originally Posted by Vladimir View Post
    Hi,

    Please see
    https://examples1.ext.net/#/Form/Com...Items_Actions/

    If you need to rebind all data via Items collection then use the following code after Items modification
    ddlMyDropdown.GetStore().DataBind();
    Thanks, that fixed it.
  6. #6
    Quote Originally Posted by ewgoforth View Post
    Added [CODE] tags.
    Thank you.

Similar Threads

  1. [CLOSED] Combobox: How to remove the duplicate items in the combobox?
    By csssi_coolite in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: May 09, 2011, 9:34 AM
  2. [CLOSED] [1.0]Problem with directMethod from custom Combobox
    By capecod in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 29, 2010, 12:52 PM
  3. [CLOSED] How to preserve items in ComboBox
    By hgouw in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: May 07, 2010, 7:03 AM
  4. Combobox Items bug ?
    By fabiomarcos in forum 1.x Help
    Replies: 3
    Last Post: Dec 26, 2008, 4:00 PM
  5. [CLOSED] Combobox items
    By fabiomarcos in forum 1.x Help
    Replies: 8
    Last Post: Dec 16, 2008, 9:16 AM

Tags for this Thread

Posting Permissions