Apr 17, 2012, 8:30 AM
[CLOSED] Difference Store behaviour Usercontrol (.ASCX) vs Class (.CS)
Hi,
i had to encapsulate a grid out of an ascx file into a class in order to use the same grid in different ascx files.
now on every directmethod of any control anywhere on the same page lifecycle starts (including the grid-control's one) and the store gets empty, eventhough it was filled properly. while embedded in ascx markup same directmethods didnt clear the store.
what is the difference between ascx-control-id-bevaviour and the same within a class file?
why the store gets transferred (cleared) without any datasource/databind setting?
i had to encapsulate a grid out of an ascx file into a class in order to use the same grid in different ascx files.
now on every directmethod of any control anywhere on the same page lifecycle starts (including the grid-control's one) and the store gets empty, eventhough it was filled properly. while embedded in ascx markup same directmethods didnt clear the store.
what is the difference between ascx-control-id-bevaviour and the same within a class file?
why the store gets transferred (cleared) without any datasource/databind setting?
public class ValueGridPanel : GridPanel
{
protected Store _storeValues;
protected override void CreateChildControls()
{
base.CreateChildControls();
_storeValues = new Store {ID = ID + "_storeValues"};
JsonReader reader = new JsonReader { IDProperty = "ObjectId" };
reader.Fields.Add(new RecordField("ObjectId"));
reader.Fields.Add(new RecordField("Label"));
_storeValues.Reader.Add(reader);
Store.Add(_storeValues);
}
[DirectMethod]
public void ChangeValue(string someId)
{
//Change values and rebind --> set is transferred correctly
values = ...;
_storeValues.DataSource = values;
_storeValues.DataBind();
}
[DirectMethod]
public void SomeOtherMethod()
{
// set is cleared without using datasource/databind
}
}
Last edited by Daniil; Apr 25, 2012 at 10:00 PM.
Reason: [CLOSED]