MultiView - Passing data between views
In many web applications, almost half of the code in “UI layer” is about dealing query strings, forms and other such thing trying to pass data between one pages to another. With new MultiView control in ASP.NET 2 and using user controls (optionally) you can avoid that whole junk.
If you can interpret the whole UI in a single ASCX/ASPX you don’t even need to use user controls for each view. However with them, things get much maintainable.
Consider you have one page where you are showing the grid, the user selects an item from the grid and you want to show its detail along with some widgets like updating that record in the second page. Refactoring it to use MultiView, you can implement these two “views” as two user controls. The parent having GridView and child having FormView. In the parent, establish an event that will get raised when the user selects some record, and in child establish a property / method using which the value will be passed.
The event in parent and property in child. BugArgument is used to hold the data that will get passed.
Now that we have all the required infrastructure in place. The container page having MultiView control becomes simpler. Here is the container page ASCX (or ASPX) and its code behind.