hello people,

I am working on a asp.net project using c# where i need display 1 or more tabs on a web page based on selection of item from drop down list.I am planning to use multiview menu control to give a feel of tabs on web page. can you please tell me is there a way to show \hide these tabs based on my selection from dropdown.

Recommended Answers

All 2 Replies

Add three buttons onto the webpage. Name of three buttons are Button1, Button2, Button3.

After that, place a Multiview onto the page and Drop three View controls inside a MultiView.

Write following code in Button's click event
for Button1_Click


for Button2_Click


for Button3_Click


preliminary idea to
use multiview and view control in asp.net using c#

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <style type="text/css">
            height: 62px;
            width: 196px;
    <form id="form1" runat="server">
    <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
        <asp:View ID="View1" runat="server">
            enter Your name :
            <asp:TextBox ID="TextBox2" runat="server" Width="182px"></asp:TextBox>
            <br />
            <br />
            enter your address :
            <asp:TextBox ID="TextBox3" runat="server" Width="184px"></asp:TextBox>
            <br />
            <br />
            enter yor age :<asp:Button ID="Button1" runat="server" onclick="Button1_Click" 
                Text="Next" Width="101px" />
        <asp:View ID="View2" runat="server">
            enter you gender :
            <asp:RadioButton ID="RadioButton1" runat="server" GroupName="r1" Text="male" />
            <asp:RadioButton ID="RadioButton2" runat="server" GroupName="r1" 
                Text="female" />
            <br />
            <br />
            enter you city&nbsp; :<asp:DropDownList ID="DropDownList1" runat="server">
            <br />
            <asp:Button ID="Button2" runat="server" onclick="Button2_Click" Text="prev" />
            &nbsp;<asp:Button ID="Button3" runat="server" onclick="Button3_Click" Text="next" 
                Width="154px" />
        <asp:View ID="View3" runat="server">
            <br />
            enter comment :
            <textarea ID="TextArea1" name="S1"></textarea><br />
            <asp:Button ID="Button5" runat="server" onclick="Button5_Click" Text="prev" />
            <asp:Button ID="Button4" runat="server" Text="Submit" Width="128px" />
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Default2 : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)

    protected void Button1_Click(object sender, EventArgs e)
        MultiView1.ActiveViewIndex = 1;

    protected void Button3_Click(object sender, EventArgs e)
        MultiView1.ActiveViewIndex = 2;

    protected void Button2_Click(object sender, EventArgs e)
        MultiView1.ActiveViewIndex = 0;
    protected void Button5_Click(object sender, EventArgs e)
        MultiView1.ActiveViewIndex = 1;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.