In our system, we have been retrieving objects from the Session and use the DataBindings to set Control Values (TextBoxes, etc.) from the Properties of Objects retrieved from the Session.
But, the IntializeDataBindings happens before the base.OnLoad method, which causes our Properties to fail.
Would there be any issue to have the OnLoad methods for Page and UserControl to call
base.OnLoad(e);
before the
BindingManager.BindSourceToTarget(this, Controller, validationErrors);
method?
Or is there a better way to do what we are trying to do?
Thanks,
Jamie
Here's code example what I'm trying to do:
public partial class TestContainerPage : Spring.Web.UI.Page
{
private TestObject testObject;
protected override void InitializeDataBindings()
{
BindingManager.AddBinding("PageTextBox.Text", "TestName");
}
protected void Page_Load(object sender, System.EventArgs e)
{
object obj = this.Session["MyTestObject"];
if (obj != null)
{
this.testObject = obj as TestObject;
}
}
public string TestName
{
get
{
return this.testObject.Name;
}
set
{
this.testObject.Name = value;
}
}
}


Reply With Quote
