MultiView空间例子

CSS代码:

 1 body 
 2 {
 3     font-size:11pt;
 4     font-family:宋体;
 5 }
 6 .mainTitle
 7 {
 8     font-size:11pt;
 9     font-weight:bold;
10     font-family:宋体;
11 }
12 .commonText
13 {
14     font-size:11pt;
15     font-family:宋体;
16 }
17 .littleMainTitle
18 {
19     font-size:10pt;
20     font-weight:bold;
21     font-family:宋体;
22 }
23 .TopTitle
24 {
25     border:0px;
26     font-size:10pt;
27     font-weight:bold;
28     text-decoration:none;
29     color:Black;
30     display:inline-block;
31     100%;
32 }
33 .SelectedTopTitle
34 {
35   border:0px;
36     font-size:10pt;
37     text-decoration:none;
38     color:Black;
39     display:inline-block;
40     100%;
41     background-color:White;  
42 }
43 .ContentView
44 {
45    border:0px;
46    padding:3px 3px 3px 3px;
47    background-color:White;
48    display:inline-block;
49    390px;  
50 }
51 .SepBorder
52 {
53   border-top-0px;
54   border-left-0px;  
55   font-size:1px;
56   border-bottom:Gray 1px solid;
57   border-right-0px;
58 }
59 .TopBorder
60 {
61   border-right: Gray 1px solid; 
62   border-top:Gray 0px solid;
63   border-left:Gray 1px solid;
64   border-bottom:Gray 1px solid;
65   height:100%;
66   100%;
67 }
68 .SelectedTopBorder
69 {
70   border-right: Gray 1px solid; 
71   border-top:Gray 1px solid;
72   background:none transparent scroll repeat 0% 0%; 
73    border-left:Gray 1px solid;
74    color:Black;
75    border-bottom: Gray 0px solid; 
76 }

aspx代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MultiView控件.aspx.cs" Inherits="WebApplication1.复合控制和模板页.MultiView控件" %>

<!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">
    <title></title>
    <link href="../Styles/01.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <fieldset style="400px";>
      <legend>MultiView应用例子</legend>
      <table cellpadding="0" cellspacing="0" width="100%" border="0">
      <tr>
       <td> 
        <table id="Table1" runat="server" 
        cellpadding="0" cellspacing="0" 
        width="100%" border="0">
          <tr style="height:22px">
          <td class="SelectedTopBorder" id="Cell1" align="center" style="80px;">
          <asp:LinkButton ID="LButtonCompany" runat="server" 
          OnClick="LButtonCompany_Click">公司介绍</asp:LinkButton>
          </td>
          <td class="SepBorder" style="2px; height:22px;"></td>
           <td class="TopBorder" id="Cell2" align="center" style="80px;">
          <asp:LinkButton ID="LButtonProduct" runat="server" 
          OnClick="LButtonProduct_Click">产品介绍</asp:LinkButton></td>

          <td class="SepBorder" style="2px; height:22px;"></td>
           <td class="TopBorder" id="Cell3" align="center" style="80px;">
          <asp:LinkButton ID="LButtonContact" runat="server" 
          OnClick="LButtonContact_Click">联系我们</asp:LinkButton></td>
          <td class="SepBorder" style="2px; height:22px;"></td>
            </tr>
        </table>
       </td>
         </tr>
         <tr>
         <td>
         <table class="ContentBorder" cellpadding="0" 
         cellspacing="0" width="100%">
           <tr>
           <td valign="top">
           <asp:MultiView ID="mvCompany" runat="server" ActiveViewIndex="0">
           <asp:View ID="View1" runat="server">
我们公司是一个正在上升时期的公司。公司目前有中科院计算机院士3人,博士后32人,
博士63人,研究生120人,本科生356人,具有非常强大的研发实力。
           </asp:View>
           <asp:View ID="View2" runat="server">
我们有丰富的产品线,还可以为用户单独制定。目前CMS文章发布系统,CRM客户资源关系管理系统,
OA自动办公化系统,正在研发的软件有GSP车辆定位导航系统及工作制度系统。
           </asp:View>
           <asp:View ID="View3" runat="server">
本公司热烈欢迎技术界和销售界的精英加入我们,客服电话123445.
           </asp:View>
           </asp:MultiView>
           </td>
           </tr>
         </table>
         </td>
         </tr>
      </table>
    </fieldset>
    </div>
    </form>
</body>
</html>

CS代码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication1.复合控制和模板页
{
    public partial class MultiView控件 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
         
        }

        protected void LButtonCompany_Click(object sender, EventArgs e)
        {
            mvCompany.ActiveViewIndex = 0;
            Cell1.Attributes["class"] = "SelectedTopBorder";
            Cell2.Attributes["class"]="TopBorder";
            Cell3.Attributes["class"] = "TopBorder";
        }

        protected void LButtonProduct_Click(object sender, EventArgs e)
        {
            mvCompany.ActiveViewIndex = 1;
            Cell1.Attributes["class"] = "TopBorder";
            Cell2.Attributes["class"] = "SelectedTopBorder";
            Cell3.Attributes["class"] = "TopBorder";
        }

        protected void LButtonContact_Click(object sender, EventArgs e)
        {
            mvCompany.ActiveViewIndex = 2;
            Cell1.Attributes["class"] = "TopBorder";
            Cell2.Attributes["class"] = "TopBorder";
            Cell3.Attributes["class"] = "SelectedTopBorder";
        }

    }
}
原文地址:https://www.cnblogs.com/ai394495243/p/3365117.html