ASP.NET中使用框架

来源:互联网 发布:录音大师软件下载 编辑:程序博客网 时间:2024/06/06 17:49

       首先要说的是在asp.net中使用框架是iframe,而不是frameset;iframe实现的功能和frameset相似;iframe使用的实例:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="main.aspx.cs" Inherits="main" %><!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></head><body style=" background-color:Gray">    <form id="form1" runat="server">    <table>        <tr >        <td style=" width:500px">          <span id="time"></span>              <script>document.getElementById('time').innerHTML=new Date().toLocaleString()+' 星期'+'日一二三四五六'.charAt(new Date().getDay());setInterval("document.getElementById('time').innerHTML=new Date().toLocaleString()+' 星期'+'日一二三四五六'.charAt(new Date().getDay());",1000);</script>        </td>            <td>                <a onclick="javascript:history.go(-1);" href="#">后退</a>            </td>            <td>                <a onclick="javascript:history.go(1);" href="#">前进</a>            </td>            <td>                <a onclick="window.frames['MainFrame'].location.reload();" href="#">刷新</a>            </td>            <td>                <a href="#">注销</a>            </td>            <td>                <a onclick="javascript:if(confirm('你确定要退出本系统吗?'))window.location='ExitSys.aspx';" href="#">退出</a>            </td>        </tr>        </table>                        <table>         <tr>            <td  rowspan="2" style=" width:50px; background-color:Silver">                <div>                     <asp:TreeView ID="TreeView1" runat="server">                    <Nodes>                        <asp:TreeNode Text="栏目管理" Value="栏目管理">                            <asp:TreeNode Text="资讯类别" Value="资讯管理" NavigateUrl="~/ArticleClassList.aspx" Target="mainiframe"></asp:TreeNode>                            <asp:TreeNode Text="下载类别" Value="下载管理" NavigateUrl="~/SoftDownList.aspx" Target="mainiframe"></asp:TreeNode>                             </asp:TreeNode>                                                    <asp:TreeNode Text="资讯管理" Value="资讯管理">                            <asp:TreeNode Text="添加资讯" Value="添加资讯" NavigateUrl="~/ArticleAdd.aspx"  Target="mainiframe"></asp:TreeNode>                            <asp:TreeNode Text="资讯列表" Value="资讯列表" NavigateUrl="~/ArticleList.aspx" Target="mainiframe"></asp:TreeNode>                        </asp:TreeNode>                        <asp:TreeNode Text="下载管理" Value="下载管理">                            <asp:TreeNode Text="添加下载" Value="添加下载" NavigateUrl="~/SoftDownAdd.aspx" Target="mainiframe"></asp:TreeNode>                            <asp:TreeNode Text="下载列表" Value="下载列表" NavigateUrl="~/SoftDownList.aspx" Target="mainiframe"></asp:TreeNode>                        </asp:TreeNode>                        <asp:TreeNode Text="系统管理" Value="系统管理">                            <asp:TreeNode Text="角色管理" Value="角色管理">                                <asp:TreeNode Text="添加角色" Value="添加角色" NavigateUrl="~/UserRolesAdd.aspx" Target="mainiframe"></asp:TreeNode>                                <asp:TreeNode Text="角色列表" Value="角色列表" NavigateUrl="~/UserRoleList.aspx" Target="mainiframe"></asp:TreeNode>                            </asp:TreeNode>                            <asp:TreeNode Text="用户管理" Value="用户管理">                                <asp:TreeNode Text="添加用户" Value="添加用户" NavigateUrl="~/UserInfoAdd.aspx" Target="mainiframe"></asp:TreeNode>                                <asp:TreeNode Text="用户列表" NavigateUrl="~/UserInfoList.aspx" Target="mainiframe"></asp:TreeNode>                            </asp:TreeNode>                        </asp:TreeNode>                        <asp:TreeNode Text="通用信息管理" Value="通用信息管理">                            <asp:TreeNode Text="添加通用信息" Value="添加通用信息" NavigateUrl="~/CommonpageAdd.aspx" Target="mainiframe"></asp:TreeNode><%--Target="mainiframe"实现了连接页面在iframe内显示,而不是跳转到别的页面--%>                            <asp:TreeNode Text="通用信息列表" Value="通用信息列表" NavigateUrl="~/CommonpageList.aspx" Target="mainiframe"></asp:TreeNode>                        </asp:TreeNode>                        <asp:TreeNode Text="网站链接管理" Value="网站链接管理">                            <asp:TreeNode Text="添加网站链接" Value="添加网站链接" NavigateUrl="~/LinksAdd.aspx" Target="mainiframe"></asp:TreeNode>                            <asp:TreeNode Text="网站链接列表" Value="网站链接列表" Target="mainiframe" NavigateUrl="~/LinksList.aspx"></asp:TreeNode>                        </asp:TreeNode>                    </Nodes>                 </asp:TreeView>                 </div>            </td>           <td>               <div>                    <iframe name="mainiframe" id="mainiframe" src="ArticleList.aspx" style=" width:850px; height:500px"></iframe><%-- 注意这里使用了iframe;并且设置它的id为mainiframe--%>                </div>            </td>        </tr>         <tr>            <td  style="background-color:Silver" >            <div>                              当前用户:<asp:Label ID="lblUserId" runat="server" Text=""></asp:Label>                     部门:<asp:Label ID="lblDept" runat="server" Text=""></asp:Label>                                          角色:<asp:Label ID="lblRoles" runat="server" Text=""></asp:Label>                                          建议分辨率:1024*768以上            </div>            </td>        </tr>    </table>    <div>            </div>    </form></body></html>

原创粉丝点击