[asp.net] Make a simple multiple-page tab function

Source: Internet
Author: User
Tags visual studio
asp.net we often in the home page to browse the classification of information, in C/s mode, often using the tab-page approach to do, and then put different information to different tabs, and then click on the page to check the contents of different pages. We can use the IFRAME of the Web page to implement this function, first set up a master WebForm1, on top of the two buttons to simulate the page sign (in the future can also use Photoshop to make more beautiful pages), and then build two form,webform2,webform3, Toggle the src attribute of the IFRAME to display different subpages when the button is pressed. The specific code is as follows:

WebForm1.aspx
<%@ Page language= "C #" codebehind= "WebForm1.aspx.cs" autoeventwireup= "false" inherits= "iframetest. WebForm1 "%>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta content= "Microsoft Visual Studio. NET 7.1" name= "generator" >
<meta content= "C #" Name= "Code_language" >
<meta content= "JavaScript" name= "vs_defaultClientScript" >
<meta content= "http://schemas.microsoft.com/intellisense/ie5" name= "Vs_targetschema" >
&LT;STYLE&GT;.AAA {
Border-top-style:none; Border-right-style:none; Border-left-style:none; Background-color: #ffcc33; Border-bottom-style:none
}
. BBB {
Border-top-style:none; Border-right-style:none; Border-left-style:none; Background-color: #99ffcc; Border-bottom-style:none
}
</STYLE>
</HEAD>
<body ms_positioning= "GridLayout" >
<form id= "Form1" method= "POST" runat= "Server" >
<asp:button id= "Button1" style= "Z-INDEX:101; left:16px; Position:absolute; TOP:24PX "runat=" Server "
text= "button" cssclass= "AAA" ></asp:button>
<asp:button id= "Button2" style= "z-index:102; left:72px; Position:absolute; TOP:24PX "runat=" Server "
text= "button" cssclass= "BBB" ></asp:Button>
<iframe id= "IFRAME1" style= "border-right:0px solid; border-top:0px solid; z-index:103; left:16px; border-left:0px solid; width:648px; border-bottom:0px solid; Position:absolute; top:40px; Height:288px "
runat= "Server" ></iframe>
</form>
</body>
</HTML>

WebForm1.aspx.cs
.
.
.

private void Button1_Click (object sender, System.EventArgs e)
{
IFRAME1. Attributes.Add ("src", "webform2.aspx");
}

private void Button2_Click (object sender, System.EventArgs e)
{
IFRAME1. Attributes.Add ("src", "webform3.aspx");
}




Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.