John -
I had quite a bit of trouble getting a usercontrol to work when the
usercontrol included webcontrols that I wanted to interact with the
parent.
The best way I found to work is to drag the usercontrol onto the
parent, then toggle the visible property, rather than using
LoadControl.
My web page is in GridLayout, so I programmatically move it to
position when it's changed to visible = true.
I also found that ViewState wasn't working. I found an usercontrol
example that showed removing the OnInit() function in the usercontrol
and replacing it with
public void Page_Init(object sender, EventArgs e)
{
InitializeComponent();
}
** I'm not sure why the example used this method. It seems like you
could just remove the base.OnInit(e) for the Designer generated code,
but I didn't try that.
Then, in the parent, add
this.Init += new System.EventHandler(this.ctlAddNewRule.Page_Init);
(** Mine is in C#, I'm not sure how to do it in VB)
I have this usercontrol on several pages, and it is working
consistently.
Dawn.
"John" <a@b.com> wrote in message news:<eb**************@tk2msftngp13.phx.gbl>...
Hi all,
I have a problem with viewstate being maintained. I use LoadControl to load
a user control and the data is sent down to the client correctly. However,
when I change some data and post it, the viewstate does not seem to load for
the user control upon sending it back down to the client. If I change the
data again, then the viewstate DOES seem to be maintained.
What gives?
Regards