• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1089
  • Last Modified:

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.
  • 2
1 Solution
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.

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;

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

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


mv.ActiveViewIndex = 0;


Open in new window

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.
shanemayAuthor Commented:
Thank you, that is what I needed.  I was able to get the menu attached as well.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now