我有一個名爲header.aspx的asp.net文件,它是index.aspx的一部分,這裏是索引的代碼的.aspx:在asp.net文件中使用asp.net代碼(response.write by another aspx)
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="index.aspx.cs" Inherits="index" %>
<!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>
<% Response.WriteFile("header.aspx"); %>
<% Response.WriteFile("body.aspx"); %>
<form runat="server">
<%= content %>
</form>
</body>
</html>
在header.aspx:
<style type="text/css">
.style1
{
width: 100%;
}
</style>
<form id="form1" runat="server">
<table border="0" cellpadding="0" cellspacing="0" class="style1">
<tr>
<td><img src="images/Banner.jpg" width="990" height="150" /></td>
</tr>
<tr>
<td>
<img src="images/HomeTopMenu.jpg" width="140" height="30" /><img src="images/AboutTopMenu.jpg" width="140" height="30" /><img src="images/PublicationTopMenu.jpg" width="195" height="30" /><img src="images/FormTopMenu.jpg" width="205" height="30" /><img src="images/LinkTopMenu.jpg" width="160" height="30" /><img src="images/ContactTopMenu.jpg" width="150" height="30" />
<% Response.Write("abc"); %>
</td>
</tr>
</table>
</form>
當我運行的Index.aspx文件時,<%回覆於( 「ABC」); %>顯示爲純文本...
如何在header.aspx中使用asp.net代碼?
感謝
什麼是你想解決? Response.Write按預期工作http://msdn.microsoft.com/en-us/library/ms525585(v=vs.90).aspx –