Mar 24, 2011, 2:20 PM
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.
"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:
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
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.