首先感谢您阅读我的问题......
我想将代码2放入代码1 ......任何人都可以帮助我。
代码1是普通的HTML页面。
code 1:
<table>
<tr>
<td>
//I want to add code 2 here..
</td>
</tr>
</table>
code 2:
if(System.IO.File.Exists(ConfigurationManager.AppSettings["DBCache"].ToString()+"Frame.xml"))
{
//something
}
答案 0 :(得分:2)
我使用ASP.NET页面已经有一段时间了。试试这个:
<script runat="server">
if (System.IO.File.Exists(ConfigurationManager.AppSettings["DBCache"].ToString()+"Frame.xml")) {
myLiteral.Text="Welcome to ASP.NET!!";
}
</script>
<table>
<tr>
<td>
<asp:Literal id="myLiteral" runat="server" />
</td>
</tr>
</table>
答案 1 :(得分:2)
这样做
<%@ Page Title="YourPage" Language="C#" %>
<table>
<tr>
<td>
<%
if(System.IO.File.Exists(ConfigurationManager.AppSettings["DBCache"].ToString()+"Frame.xml")) {
}
%>
</td>
</tr>
</table>
答案 2 :(得分:1)
应该是以下内容:
<table>
<tr>
<td>
<% if(your condition)
{%>
<% } %>
</td>
</tr>
</table>