Multiview in ASP.NET C#

Hi friends do you know that if you want to use multiple form in one single page then you don't need to use multiple forms in a series like one page after another page something like that now i will tell you a simple way that help you to do this in a single form use this it is very simple and save lot of space



Step 1.
 Drag MultiView form Toolbox in your form and give 0 to the ActiveViewIndex in Properties window

Step 2.
Now Drag View from your form but this time put it inside the MultiView and you can drag similarly multiple "View" inside MultiView [Note: MultiView should be one and inside MultiView their may be many View which provide you like multiple pages facility and but remember that first View is the default state because when you run this page first View will display].
Step 3.
Now each View in MultiView have their own ActiveViewIndex Properties like 1,2,3 according to the no. of View usage and remember that first View has 0 ActiveViewIndex Properties because it is first,
To jump one View to another View lets take 2-2 button on each View so Drag it from Toolbox and place it in appropriate View

And now give them proper name and Id  for clear identification so that there will be no confusion  between them,
Now what we have to do, just double click on first button in First View to jump to another View whose ActiveViewIndex Properties is 1
Write this simple single line code:
                                    MultiView1.ActiveViewIndex = 1;
Similarly for View whose ActiveViewIndex Properties is 2                                 
                                    MultiView1.ActiveViewIndex = 2;
 and also if you want to jump to previous View whose ActiveViewIndex Properties is 1 just double click on second button inside View 2 and   write the similar code
                                    MultiView1.ActiveViewIndex = 1;
Or if jump to first View then 
                                    MultiView1.ActiveViewIndex = 0;
Is it cool and simple so use it and enjoy coding ...........bye



No comments:

Post a Comment