如果在aspx页面声明 [英] If statement in aspx page
本文介绍了如果在aspx页面声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想写一个基本的,如果我的网站上声明,显示无论是第1项或第2项取决于如果一个变量设置为true。
I want to write a basic if statement on my site to display either item 1 or item 2 depending on if a variable is set to true.
我不是太熟悉.NET和需要如何得到一个if语句到aspx页面上工作的基本结构有一点帮助。
I'm not too familiar with .NET and need a little help with the basic structure of how to get an if statement to work on the aspx page
推荐答案
如果目的是要显示或隐藏页面的一部分,那么你可以做以下的事情
if the purpose is to show or hide a part of the page then you can do the following things
1)包装在标记
<% if(somecondition) { %>
some html
<% } %>
2)包装在面板控制和$ C $部分cbehind使用if语句设置面板的Visible属性。
2) Wrap the parts in a Panel control and in codebehind use the if statement to set the Visible property of the Panel.
GRZ,克里斯。
这篇关于如果在aspx页面声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文