E
ewolfman
Hi all,
I've created a TabControl webcontrol. It's quite nice and simple and
relies on an existing Multiview's Views as tabs. On the Page_PreInit, I
simple add the multiview control to the TabControl, and the multiview
is rendered as a server tab control.
The Multiview contains several comboboxes which are bound to different
datasources (the combo boxes are design time controls and so it the
Multiview. The TabControl is a dynamically added control which is added
to the page on the Page_PreInit, as previously mentioned).
protected void Page_PreInit()
{
TabControl tabControl = new TabControl();
tabControl.Controls.Add(this.MultiView1);
this.PlaceHolder1.Controls.Add(tabControl);
}
Here's my problem:
When I comment-out the lines which create the TabControl and add the
Multiview as a child control to it (i.e. the Multiview remains a child
of the form, as designed initially in design time) - I'm required to
load the datasources only once (using Page.IsPostback). Everything
works fine. The comboboxes retain their states and values from postback
to postback.
However, when I uncomment the TabControl lines, Once posted back, the
comboboxes are empty, and I must comment the Page.IsPostback line in
order to reload the datasources over and over again. This works fine,
but its clear to me that something is wrong with my TabControl.
My guess is that the comboboxes' state is not restored for some reason
when they are inside a multiview which is inside my tabcontrol. If so,
then some how I must trigger this state restoration or stop
interferring with it.
Finally, I'd appreciate answers which will not ask me to place the
TabControl as a design time object.
Thanks.
I've created a TabControl webcontrol. It's quite nice and simple and
relies on an existing Multiview's Views as tabs. On the Page_PreInit, I
simple add the multiview control to the TabControl, and the multiview
is rendered as a server tab control.
The Multiview contains several comboboxes which are bound to different
datasources (the combo boxes are design time controls and so it the
Multiview. The TabControl is a dynamically added control which is added
to the page on the Page_PreInit, as previously mentioned).
protected void Page_PreInit()
{
TabControl tabControl = new TabControl();
tabControl.Controls.Add(this.MultiView1);
this.PlaceHolder1.Controls.Add(tabControl);
}
Here's my problem:
When I comment-out the lines which create the TabControl and add the
Multiview as a child control to it (i.e. the Multiview remains a child
of the form, as designed initially in design time) - I'm required to
load the datasources only once (using Page.IsPostback). Everything
works fine. The comboboxes retain their states and values from postback
to postback.
However, when I uncomment the TabControl lines, Once posted back, the
comboboxes are empty, and I must comment the Page.IsPostback line in
order to reload the datasources over and over again. This works fine,
but its clear to me that something is wrong with my TabControl.
My guess is that the comboboxes' state is not restored for some reason
when they are inside a multiview which is inside my tabcontrol. If so,
then some how I must trigger this state restoration or stop
interferring with it.
Finally, I'd appreciate answers which will not ask me to place the
TabControl as a design time object.
Thanks.