Apr 21, 2014, 7:10 PM
[CLOSED] DataBound null on Grid Store
I have a grid with a store. The store is normally loaded by copying items from another grid (and this works perfectly with JavaScript). However, I am writing functionality for users to save a workset with their selections, and another function for loading saved worksets into the grids.
In the latter function (loading saved worksets), I have multiple grids and so multiple List<SomeObject> properties of the workset object. But I am having a problem with the data store behind one of the grids: the "data" attribute is null and the "databound" attribute is null, with a datasource which contains items, after assigning a data source and data binding:
This is a stub of the workset object logic:
And this is a stub of the Workset loading logic:
Thanks!
Patrick
In the latter function (loading saved worksets), I have multiple grids and so multiple List<SomeObject> properties of the workset object. But I am having a problem with the data store behind one of the grids: the "data" attribute is null and the "databound" attribute is null, with a datasource which contains items, after assigning a data source and data binding:
This is a stub of the workset object logic:
//In a class file
public class MyWorksetObject
{
public int MyWorksetObjectID {get; set;}
public DateTime MyWorksetObjectDate {get; set;}
public MyItemList MyWorksetObjectItems {get; set;}
public MyTaskList MyWorksetObjectTasks {get; set;}
public MyWorksetObject() {}
public MyWorksetObject(int myWorksetObjectID)
{
MyWorksetObjectID = myWorksetObjectID;
}
Load()
{
//Lots of things done
}
}
public class MyTaskList : List<MyTask>()
{
public MyTaskList ReturnTestVector()
{
MyTaskList newTestVector = new MyTaskList ();
newTestVector.Add(new MyTask(1, "First Task"));
newTestVector.Add(new MyTask(2, "Second Task"));
newTestVector.Add(new MyTask(3, "Third Task"));
return newTestVector ;
}
}
And this is a stub of the Workset loading logic:
//In code behind of page
[DirectMethod]
public void MyWorkset_Load()
{
int myWorksetObjectID = 1; //Test vector ID
MyWorksetObject myWorkset = new MyWorksetObject(myWorksetObjectID);
myWorkset.Load();
MyGrid.GetStore().DataSource = myWorkset.MyWorksetObjectTasks;
//In the debugger, MyWorksetObjectTasks has a count of 3.
MyGrid.GetStore().DataBind();
//In the debugger, the MyGrid object says the data source has a count of 3,
// but .data is null and .DataBound is null.
MyGrid.DoLayout();
}
Is there something fundamental I'm missing about how to bind this grid store from the code behind? I'm using a pageproxy on the store.Thanks!
Patrick
Last edited by Daniil; Apr 22, 2014 at 8:27 PM.
Reason: [CLOSED]