G
gregor.cieslak
Hi,
how you people handle that issue:
you have one page and one control.
in your page, you load some kind of object based on the given
parameter:
Page:
protected override void OnInit(EventArgs e)
{
InitializeComponent();
// Get Profile
this.profile = (UserProfile)EntityCache.Get ( Request["profileId"] );
// Set profile object to child control
this.profileControl.Profile = this.profile
}
------------------------
...in your control, you need that profile object the page already got
Control:
private UserProfile profile;
public UserProfile Profile
{
get { return this.profile; }
set { this.profile = value; }
}
protected override void OnInit(EventArgs e)
{
// Do something with the profile object
Populate( this.Profile );
}
------------------------
now here is the problem:
the OnInit Event in the control is always fired first,
so i have no chance to load the profile object in the Page and then set
it to the control, so now it leads that the profile object in the
control is always null.
i could solve that by moving the OnInit code in the control, to the
Page_Load, but i need that code in the OnInit Event due custom
events...
how you guys handle that?
thanks,
gregor
how you people handle that issue:
you have one page and one control.
in your page, you load some kind of object based on the given
parameter:
Page:
protected override void OnInit(EventArgs e)
{
InitializeComponent();
// Get Profile
this.profile = (UserProfile)EntityCache.Get ( Request["profileId"] );
// Set profile object to child control
this.profileControl.Profile = this.profile
}
------------------------
...in your control, you need that profile object the page already got
Control:
private UserProfile profile;
public UserProfile Profile
{
get { return this.profile; }
set { this.profile = value; }
}
protected override void OnInit(EventArgs e)
{
// Do something with the profile object
Populate( this.Profile );
}
------------------------
now here is the problem:
the OnInit Event in the control is always fired first,
so i have no chance to load the profile object in the Page and then set
it to the control, so now it leads that the profile object in the
control is always null.
i could solve that by moving the OnInit code in the control, to the
Page_Load, but i need that code in the OnInit Event due custom
events...
how you guys handle that?
thanks,
gregor