前台代码
<table>
<tr>
<td id="mydiv1" style="DISPLAY: none" align="center" colSpan="2">
<input type="text" size="72" name="DKC" runat="server"id="DKC">
</td>
</tr>
</table>后台代码
private void Page_Load(object sender, System.EventArgs e)
{
int showfg= GetValue(this);
//GetValue(this)是个函数 得到值是1或者2
//我想当showfg=1时 前台<td id="mydiv1" style="DISPLAY: none" 此列隐藏
//而当showfg=2时 前台<td id="mydiv1" style="DISPLAY: ''" '此列显示
这代码怎么写呢
}
<table>
<tr>
<td id="mydiv1" style="DISPLAY: none" align="center" colSpan="2">
<input type="text" size="72" name="DKC" runat="server"id="DKC">
</td>
</tr>
</table>后台代码
private void Page_Load(object sender, System.EventArgs e)
{
int showfg= GetValue(this);
//GetValue(this)是个函数 得到值是1或者2
//我想当showfg=1时 前台<td id="mydiv1" style="DISPLAY: none" 此列隐藏
//而当showfg=2时 前台<td id="mydiv1" style="DISPLAY: ''" '此列显示
这代码怎么写呢
}
<table>
<tr>
<td id="mydiv1" runat=server align="center" colSpan="2" ru>
<input type="text" size="72" name="DKC" runat="server"id="DKC">
</td>
</tr>
</table>
private void Page_Load(object sender, System.EventArgs e)
{
int showfg= GetValue(this);
//GetValue(this)是个函数 得到值是1或者2
//我想当showfg=1时 前台<td id="mydiv1" style="DISPLAY: none" 此列隐藏
//而当showfg=2时 前台<td id="mydiv1" style="DISPLAY: ''" '此列显示
if(showfg==1)
{
this.mydiv1.Visible=false;
}
else
{
this.mydiv1.Visible=true;
}
}
后台加声明
---------------------------------
private string _displayValue;
public string Display {
get { return _displayValue; }
set {
_displayValue = "none";if ("2" == value) {
_displayValue = "";
}
}
}
------------------------------------
Display = showfg; //赋值部分------------------------------------页面部分------------------
<td id="mydiv1" style="DISPLAY: <%=Display %>" align="center" colSpan="2">
<input type="text" size="72" name="DKC" runat="server"id="DKC">
</td>