Populating MultiCombo in Page_Load : "This operation requires an AjaxRequest"

  1. #1

    Populating MultiCombo in Page_Load : "This operation requires an AjaxRequest"

    Hey!

    First; I have browsed numerous posts on this forum that relates to my question but haven't really figured out what to do here.

    So, I have a MultiCombo that I want to populate in the Page_Load of that page.

    <ext:MultiCombo ID="MultiCombo_allowedLoginChannels" runat="server" SelectionMode="All" FieldLabel="Some text" Width="175">
                    <Items></Items>
                </ext:MultiCombo>
    and my code for populating the MultiCombo:

    Assembly[] asms = AppDomain.CurrentDomain.GetAssemblies();
                    foreach (Assembly assembly in asms)
                    {
                        Type[] typeArray = assembly.GetTypes();
                        foreach (Type type in typeArray)
                        {
                            if (type.IsSubclassOf(typeof(SomeVeryCoolType)))
                            {
                                MultiCombo_allowedLoginChannels.AddItem(type.Name, type);
                            }
                        }
                    }
    When I hit
    MultiCombo_allowedLoginChannels.AddItem(type.Name, type);
    I get the error:
    "This operation requires an AjaxRequest"

    So I started to surf, and read some posts (here, here for example) but to no avail.

    So my question is obvious:

    How should you populate a MultiCombo? Can I do it in Page_load? Im obviously missing something =)

    ------ UPDATE -----------

    So I figured out one solution that sort of works. I create a Store in markup, then in the Page_Load method I do this:

    List<object> asd = new List<object>();
                
    
                Assembly[] asms = AppDomain.CurrentDomain.GetAssemblies();
                foreach (Assembly assembly in asms)
                {
                    Type[] typeArray = assembly.GetTypes();
                    foreach (Type type in typeArray)
                    {
                        if (type.IsSubclassOf(typeof(MyNiceType)))
                        {
                            asd.Add(new object[] { type.ToString(), type.Name, type });
                        }
                    }
                }
    
                Store_LoginChannels.DataSource = asd;
                Store_LoginChannels.DataBind();
    The MultiCombo looks like this:

    <ext:MultiCombo ID="MultiCombo_allowedLoginChannels" runat="server" SelectionMode="All" FieldLabel="Inloggning via" Width="175" StoreID="Store_LoginChannels"
                    DisplayField="typeName"
                    ValueField="typeObject"
                    EmptyText="Välj">
                </ext:MultiCombo>
    and the Store:

    <ext:Store ID="Store_LoginChannels" runat="server">
            <Reader>
                <ext:ArrayReader>
                    <Fields>
                        <ext:RecordField Name="typeStringId" />
                        <ext:RecordField Name="typeName" />
                        <ext:RecordField Name="typeObject" />
                    </Fields>
                </ext:ArrayReader>
            </Reader>
        </ext:Store>
    The problem now is that it doesnt work like I want it to, ie I cannot select anything from the list. It works fine if I hardcode in <Items> in there, but using the Store I cant get it to work just yet...

    Someone can clse this thread =)

    --- Update 2 ---

    The last issue, that I cannot select anything from the MultiComb, is explained here:
    http://forums.ext.net/showthread.php...-items-in-list
    Last edited by wagger; Mar 28, 2011 at 10:57 AM.

Similar Threads

  1. [CLOSED] "Select All" option in MultiCombo
    By pj_martins in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Oct 31, 2013, 9:13 PM
  2. Replies: 5
    Last Post: May 02, 2012, 5:37 PM
  3. Error: "This operation requires AJAX request"
    By rpk2006 in forum 1.x Help
    Replies: 1
    Last Post: Mar 09, 2012, 3:43 PM
  4. Replies: 4
    Last Post: Oct 11, 2011, 2:42 AM
  5. "populating combobox via ajaxevent" problem
    By unaltro2 in forum 1.x Help
    Replies: 0
    Last Post: Nov 16, 2010, 7:43 AM

Tags for this Thread

Posting Permissions