Load items in combobox from codebehind

  1. #1

    Load items in combobox from codebehind

    Hello,
    I try to load items in the combobox from codebehind but it doesnt work. Combobox is not expanding when I click the trigger.
    Here is my code:

    var callDM = function (){
                #{DirectMethods}.fillComboDates();
            }
    
    
    <ext:ComboBox  runat="server" ID="cmbFormatFFC"   DataIndex="DateFormat"          FieldLabel="Date Format"             Width="400" ForceSelection="true" EmptyText="Select date format...">
             <Listeners>
                   <BoxReady Fn="callDM()" /> //tried also BeforeRender but no luck
             </Listeners>
    </ext:Combobox>
    and the direct method in code behind:
    [DirectMethod]
            public void fillComboDates()
            {
                cmbFormatFFC.Items.Insert(0, new Ext.Net.ListItem(DateTime.Now.ToString("d/M/yyyy"), "d/M/yyyy"));
                cmbFormatFFC.Items.Insert(1, new Ext.Net.ListItem(DateTime.Now.ToString("dd-MMM-yyyy"), "dd-MMM-yyyy"));
            }
  2. #2
    Hello @atroul!

    Please check out our examples on the combo box component, there are several showing how to load/refresh data to them, I'm sure you'll find one fitting your scenario. Here's a good start: Combo Box - Ajax linked combos.

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. [CLOSED] LAYOUT: Render CodeBehind in <ViewPort> <Items>
    By atroul in forum 4.x Legacy Premium Help
    Replies: 5
    Last Post: Jan 19, 2017, 10:14 PM
  2. [CLOSED] How to create and load store to combobox in codebehind
    By opendat2000 in forum 2.x Legacy Premium Help
    Replies: 8
    Last Post: Apr 21, 2015, 3:24 PM
  3. Replies: 4
    Last Post: Jul 15, 2014, 10:59 AM
  4. [CLOSED] Adding FormPanel Items from Codebehind
    By debarry in forum 2.x Legacy Premium Help
    Replies: 6
    Last Post: Jun 26, 2014, 5:07 PM
  5. select items of MultiCombo in codebehind
    By JCarlosF in forum 2.x Help
    Replies: 6
    Last Post: Aug 05, 2013, 3:07 PM

Tags for this Thread

Posting Permissions