我想在asp其他aspx文件主aspx文件我能做到这一点在JSP中JSP中code包括像
< JSP:包括页=footer.jsp中/>解决方案
您不能在另一个页面添加到asp现有的页面。因为 asp 不允许两个 form标签在同一页面。有喜欢的用户控制功能,你可以使用更多详细信息 HTTP://www.$c$cproject /文章/ 1739 /用户控制功能于ASP-NET
编辑1更进一步有主网页的概念和内容页 这里是一个很好的链接,母版页的www.$c$cproject/Articles/325865/Creating-Master-Page-In-ASP-NET-2010
编辑2法师页面有类似下面的结构
<%@主语言=C#AutoEventWireup =真codeFILE =MasterPage.master.cs继承=母版%GT;!< DOCTYPE HTML PUBLIC - // W3C // DTD XHTML 1.0过渡// ENwww.w3/TR/xhtml1/DTD/xhtml1-transitional.dtd\">< HTML的xmlns =http://www.w3/1999/xhtml><头=服务器> <标题>< /标题> < ASP:的ContentPlaceHolder ID =头=服务器> < / ASP:&的ContentPlaceHolder GT;< /头><身体GT; <表ID =form1的=服务器> < DIV> < ASP:的ContentPlaceHolder ID =ContentPlaceHolder1=服务器> < / ASP:&的ContentPlaceHolder GT; < / DIV> < /表及GT; < /身体GT;< / HTML>要注意的
很少点当你箱页面,你只能在 ContentPlaceHolder1 添加内容,可以有很多的这些。你可以把你的用户控件在母版页也使得它都会对你的网页中反映出来。
编辑3 母版页实际上是用户控件;你可以到你的母版页类的code-背后验证这一点,在类名称上点击右键并选择转到定义。你会看到这样的事情:
公共类母版:用户控件{ ...}用户控件
是便于被反复withing单个项目显示元件,例如菜单和面板。的问题是,它们不会产生.DLL文件并且必须手工复制到其它的项目,如果需要的话。 一些好的链接相当于ASP.NET服务器端包含 How包括在asp页面外部HTML文件
i want to include other aspx file to main aspx file in asp i could do it in jsp the code in jsp include like that
<jsp:include page="footer.jsp" />解决方案
You can not add another page to the existing page in asp. Because asp does not allow two form tag in the same page. There are feature like user control which you can use More detail www.codeproject/Articles/1739/User-controls-in-ASP-NET
Edit 1Further more There is a concept of Master page and content page Here is a good link for master page www.codeproject/Articles/325865/Creating-Master-Page-In-ASP-NET-2010
Edit 2Master page has a structure like below
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "www.w3/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="www.w3/1999/xhtml"> <head runat="server"> <title></title> <asp:ContentPlaceHolder id="head" runat="server"> </asp:ContentPlaceHolder> </head> <body> <form id="form1" runat="server"> <div> <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server"> </asp:ContentPlaceHolder> </div> </form> </body> </html>Few point to be noted When you crate a Page you can add content only in ContentPlaceHolder1, there can be many of these. You can put your user-control inside master-page also so that it will be reflected all over you pages.
Edit 3 Master pagesare actually user controls; you can verify this by going to the code-behind of your master page class, right-click on the class name and select "Go To Definition". You will see something like this:
public class MasterPage : UserControl { ... }User controls
are convenient for display components that are repeated withing a single project, such as menus and panels. The problem is that they do not generate .DLLs and have to be hand-copied to other projects, if needed. Some good links ASP.NET equivalent of server side includes How to include an external html file in asp page
更多推荐
如何包括其他页面,aspx文件
发布评论