---
title: "Multiview in ASP.NET"  
description: "In this blog, I’m explaining about Multiview in .Net  The Multiview acts like a standalone controls  It is a container that can hold various “view” co"  
author: "priyanka kushwaha"  
published: 2015-02-18  
updated: 2015-02-18  
canonical: https://www.mindstick.com/blog/771/multiview-in-asp-dot-net  
category: ".net"  
tags: ["c#", "asp.net"]  
reading_time: 2 minutes  

---

# Multiview in ASP.NET

In this [blog](https://www.mindstick.com/articles/12705/myths-and-misconception-about-blog), I’m explaining about Multiview in .Net

\

The Multiview acts like a standalone [controls](https://www.mindstick.com/articles/66/how-to-create-controls-at-run-time-in-csharp-dot-net) It is a [container](https://www.mindstick.com/forum/159610/how-to-connect-a-windows-container-to-a-service-running-on-localhost) that can hold various “[view](https://yourviews.mindstick.com/view/84701/layoffs-in-google-india-2023-view)” controls. And the “view” [control](https://www.mindstick.com/blog/197/asp-dot-net-repeater-control) can hold any number of other controls, the benefit is they are [group](https://yourviews.mindstick.com/view/81323/adani-green-energy-group-bags-world-s-biggest-solar-bid) [together](https://yourviews.mindstick.com/view/80819/live-in-relationship-protecting-the-right-to-live-together), so that its easy to provide visibility.

\

##### Example

1. Create a .aspx file

```
 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Multiview.aspx.cs" Inherits="MultiviewsTopic.Multiview" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"><head runat="server">    <title></title></head><body>    <form id="form1" runat="server">        <div>            <table border="0" cellpadding="2" cellspacing="3" width="100%">                 <tr>                    <td>                        <asp:LinkButton ID="lnkTab1" runat="server" OnClick="lnkTab1_Click">Tab1</asp:LinkButton></td>                    <td>                        <asp:LinkButton ID="lnkTab2" runat="server" OnClick="lnkTab2_Click">Tab2</asp:LinkButton></td>                    <td>                        <asp:LinkButton ID="lnkTab3" runat="server" OnClick="lnkTab3_Click">Tab3</asp:LinkButton></td>                </tr>                <tr>                    <td colspan="3">                        <asp:MultiView ID="MultiView1" runat="server">                            <table width="100%" cellpadding="2" cellspacing="5">                                <tr>                                    <td>                                        <asp:View ID="View1" runat="server">                                            <table>                                                <tr>                                                    <td>User Name</td>                                                    <td>                                                        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></td>                                                </tr>                                                <tr>                                                    <td>Password</td>                                                     <td>                                                        <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox></td>                                                </tr>                                                <tr>                                                    <td colspan="2">                                                        <asp:Button ID="btn" runat="server" Text="Submit" /></td>                                                </tr>                                            </table>                                        </asp:View>                                    </td>                    <td>                        <asp:View ID="View2" runat="server">                            <div style="width: 100%;">                                <asp:ScriptManager ID="ScriptManager1" runat="server" />                                <asp:Timer ID="Timer1" Interval="2000" runat="server" />                                <asp:UpdatePanel ID="up1" runat="server">                                    <Triggers>                                        <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />                                    </Triggers>                                    <ContentTemplate>                                        <asp:AdRotator                                            ID="AdRotator1"                                            AdvertisementFile="~/XMLFile.xml"                                            runat="server" Target="_top" Width="500px" />                                    </ContentTemplate>                                </asp:UpdatePanel>                            </div>                        </asp:View>                    </td>                    <td>                        <asp:View ID="View3" runat="server">                            content 3 goes here                        </asp:View>                    </td>                </tr>                </table>                        </asp:MultiView></td>                </tr>            </table>            <div>            </div>        </div>    </form></body></html>
```

##### Write in .cs file

```
namespace MultiviewsTopic{    public partial class Multiview : System.Web.UI.Page    {        protected void Page_Load(object sender, EventArgs e)        {            if (!IsPostBack)            {                SetDefaultView();            }        }        private void SetDefaultView()        {            MultiView1.ActiveViewIndex = 0;            MultiView1.SetActiveView(View2);        }         protected void lnkTab1_Click(object sender, EventArgs e)        {            MultiView1.ActiveViewIndex = 0;        }         protected void lnkTab2_Click(object sender, EventArgs e)        {            MultiView1.ActiveViewIndex = 1;        }         protected void lnkTab3_Click(object sender, EventArgs e)        {            MultiView1.ActiveViewIndex = 2;        }     }}
```

2. Create a [XML file](https://www.mindstick.com/articles/75/how-to-read-and-write-xml-file-through-c-sharp)

```
<?xml version="1.0" encoding="utf-8" ?><Advertisements>  <Ad>    <ImageUrl>~/images/A.jpg</ImageUrl>    <width>40px </width>    <height>50px</height>    <NavigateUrl>http://www.pastelspace.com/image_detail.php?id=1228</NavigateUrl>     <AlternateText>DotNetCurry Home Page</AlternateText>    <Impressions>40</Impressions>    <Keyword>small1</Keyword>  </Ad>  <Ad>    <ImageUrl>~/images/B.jpg</ImageUrl>    <width>40px </width>    <height>50px</height>    <NavigateUrl>http://www.pastelspace.com/image_detail.php?id=1034</NavigateUrl>    <AlternateText>DotNetCurry Home Page</AlternateText>    <Impressions>40</Impressions>    <Keyword>small2</Keyword>  </Ad>  <Ad>    <ImageUrl>~/images/C.jpg</ImageUrl>    <width>40px</width>    <height>50px</height>    <NavigateUrl>http://www.dotnetcurry.com</NavigateUrl>    <AlternateText>DotNetCurry Home Page</AlternateText>    <Impressions>40</Impressions>    <Keyword>small</Keyword>  </Ad></Advertisements>
```

##### Output:\

![Multiview in ASP.NET](https://www.mindstick.com/blogs/bb8e5c3e-1114-4d5e-b2e3-6364ef680229/images/bd50e3be-4b11-4f91-8f92-660de56b3854.png)

![Multiview in ASP.NET](https://www.mindstick.com/blogs/bb8e5c3e-1114-4d5e-b2e3-6364ef680229/images/15510b65-c404-4731-bcac-97525d1c4e0c.png)

---

Original Source: https://www.mindstick.com/blog/771/multiview-in-asp-dot-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
