I'm developing a web page - asp.net ( .net 3.5 - visual studio 2008 ) :
This is my idea :
I need to add Controls to a web form page programmatically (labels, textboxes, ect..)
Controls must be grouped into "Sections".
I Inserted a Multiview into my page.
When I load the page, I retrieve information about controls in a database.
Then I create a view and add it to multiview control and so add controls to each view.
Now I want display my "sections" like tab strips :
My code (more or less) :
protected void Page_PreInit(Object sender, EventArgs e)
this.MultiViewSections.ActiveViewIndex = 0;
private void ChargeControls()
read database table
for each record
viewSection = new View();
viewSection.ID = "Section" ;
int indexSection = 0 ;
label = new Label();
label.ID = "lblSection" ;
label.Text = "text Section";
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
I can see first view
( this.MultiViewSections.ActiveViewIndex = 0; ).
But I can't navigate to others views , I get this error :
ActiveViewIndex is being set to '0'. It must be smaller than the current number of View
For dynamically added views, make sure they are added before or in Page_PreInit event.
Parameter name: value
I inserted two buttons into the page and I try to use these instructions :
NextView/PrevView , SwitchViewByID, MultiView1.ActiveViewIndex += 1 / -= 1 .
what's wrong ?
Thanks in advance .
A MultiView control is a good choice in this situation ?