Working with MultiView control in Asp.Net 2.0 to show the same page with different views

Hi

Data collection is a common task in web application. We might have to collect data for survey and display result or use the contact us form and after the form is submitted show the user a response that the information has been submitted.

Most the time people transfer these into multiple pages so that the user does not have to see a real long page, and feel that he has to input too much of data.

Many a times in Asp.Net 1.X developer used to complete this task in one form by using multiple panels. They would hide and unhide panels (having a set of controls). This was easier then to create multiple pages for the job.

In Asp.Net we have the MultiView control to work around this problem. This is a new control in Asp.Net 2.0. MultiView makes life easier for developer when they have to show one view at a time out of many views in the same page.

To use a MultiView control drag one of the multi view control in the page and add as many view controls as you want inside the MultiView

There are a few important property and event in the MultiView to create the effect of multiage in SetActiveView. First of all we need to set the ActiveViewIndex of the MultiView. This defines the view that will be active in the MultiView. If you want to change the active view of the MultiView by the name of the MultiView than use the SetActiveView property of the MultiView which takes the name of the view as the parameter.

We also have an event for when the Active view of the MultiView changes. We can use this event to make additional changes to the pages when the active view of the MultiView changes.

That’s all you need to do to work with the MultiView control. One of the advantage of MultiView control over using multiple panel is that MultiView control does not Emit any HTML of its own while a panel will emit the HTML Panel.

Hope this helps
Thanks
Vikram


Share this post   Email it

Feedback

Posted on 10/27/2007 3:58:41 AM

good ne

Please post your comments:

Name:  
Email (optional): Your email address will not be posted.
URL (optional):
Comments: HTML will be ignored, URLs will be converted to hyperlinks  
Enter the text you see in the box:
 

Copyright © 2006 - 2010 Vikram Lakhotia