Dynamic MultiView asp.net

I have a page that dynamically creates GridViews based on user input, I would like to put each gridview in a "view" within a multiview so the page is not so cluttered.  I am not sure how to dynamically create a multiview with a menu so the user can "tab" between the views.  I understand how the controls work, I have never attempted to create it all manually before.  Any help would be greatly appreciated.  I am coding in C# asp.net 3.5.  Thank you for any help or guidance.
shanemayAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Richard LeeSoftware EnthusiastCommented:
The code below is a good start for you. It demonstrates how to dynamically create a MultiView, 2 Gridviews and add the dynamically created gridviews with bound data to the a view and then to the multiview.

You would need to have a PlaceHolder webcontrol named PlaceHolderContainer inside your markup.

DaTribe
var testData1 = new[]
                	{
						new { Id = 1, Name = "One"},
						new { Id = 2, Name = "Two"}
                	};
var testData2 = new[]
                	{
						new { Id = 3, Name = "Cow"},
						new { Id = 4, Name = "Horse"}
                	};

MultiView mv = new MultiView();
GridView gv1 = new GridView();
gv1.DataSource = testData1;
gv1.DataBind();

GridView gv2 = new GridView();
gv2.DataSource = testData2;
gv2.DataBind();

View v1 = new View();
View v2 = new View();

v1.Controls.Add(gv1);
v2.Controls.Add(gv2);

mv.Views.Add(v1);
mv.Views.Add(v2);
mv.ActiveViewIndex = 0;

PlaceHolderContainer.Controls.Add(mv);

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
shanemayAuthor Commented:
Thank you for the response, that does put me on the right path, How might I add the menu to the multiview.  I can create the menu, I am just not sure how to associate it with the multiview.
0
shanemayAuthor Commented:
Thank you, that is what I needed.  I was able to get the menu attached as well.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.