Nov 03, 2010, 10:43 PM
Assigning dynamic store to a dynamic combobox.
I can create a store and a combobox on the codebehind. I am just not sure how I assign this store to the combobox.
//Add Subject Combobox
ComboBox comboSubject = new ComboBox();
comboSubject.FieldLabel = "Subject";
// it would accept xStore to comboSubject.Store (Cannot implicitly convert type 'Ext.Net.Store' to 'Ext.Net.StoreCollection')
comboSubject.Store = xStore();
comboSubject.ValueField = "SubjectCode";
comboSubject.DisplayField = "Description";
comboSubject.AnchorHorizontal = "95%";
comboSubject.AddTo(subContainSubject);
//Create a Store
private Ext.Net.Store xStore()
{
//Get the data for the store
SubjectBLL subjectBLL = new SubjectBLL();
List<Subject> subjectList = new List<Subject>();
subjectList = subjectBLL.getAllSubjects();
//Create the store
JsonReader _jsonReader = new JsonReader();
Store xStore = new Store();
_jsonReader.Fields.Add("Description");
_jsonReader.Fields.Add("SubjectCode");
xStore.Reader.Add(_jsonReader);
xStore.DataSource = subjectList;
xStore.DataBind();
return xStore;
}
Not sure how I get this working.:confused: