I am using Ext.net 3.0. I have a combo box and created store in it to get multiple values from server side. It's getting 5 value from server side, but it display only blank list.
Coding for combo box..............
<ext:ComboBox runat="server" ListWidth="350" ID="Branches" FieldLabel="Branch" DisplayField="Name" ValueField="Number" AllowBlank="false">
<Store>
<ext:Store runat="server">
<Reader>
<ext:JsonReader IDProperty="Number">
<Fields>
<ext:RecordField Name="Number"></ext:RecordField>
<ext:RecordField Name="Name"></ext:RecordField>
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
</Store>
</ext:ComboBox>
Server side coding.......
var branchList = from b in Branches select new { Number = b.Number, Name = b.Name };
List<object> listBranchToAdd = new List<object>();
foreach (var a in branchList)
{
listBranchToAdd.Add(a);
}
Branches.Store.Primary.DataSource = listBranchToAdd;
Branches.Store.Primary.DataBind();
My Research -
Someone said that, don't add a combo in store directly, create a store separately by given store id and then use store id in combo, but it doesn't work.
var branchList returning value.. I have checked it. When i use cmbBranches.setValue(listBranchToAdd[0]); then it display value in Fiddler. but doesn't display in combo box properly.
3.Just give a storeId in store and use in server side for binding data in store instead of binding in combobox. I have tried it but it doesn't work.
Finally, I got a solution of this question. I didn't properly understand the actual logic why it's working but it works proper.
Previous Code - It was not working
New Code - It is working