为什么按钮不隐藏
我页面中有两按钮分别是添加和修改
前面代码: <asp:button id="btnSubmit" runat="server" Width="80px" CssClass="input" Text="添加" OnClick="btnSubmit_Click" visible=' <%#this.AllowAdd%>'> </asp:buttton>
<asp:button id="btnEdit" runat="server" Width="80px" CssClass="input" Text="修改" visible=' <%#this.AllowEdit%>'> </asp:button>
后台代码:
public bool AllowAdd
{
get { return Convert.ToBoolean(ViewState["AllowAdd"]); }
set { ViewState["AllowAdd"] = value; }
}
public bool AllowEdit
{
get { return Convert.ToBoolean(ViewState["AllowEdit"]); }
set { ViewState["AllowEdit"] = value; }
}
我想当是初始添加时,把修改按钮隐藏。所以在初始化时,我设置如下:
if (!IsPostBack)
{
this.AllowAdd = true;
this.AllowEdit = false;
}
但初始打开页面时,为什么修改按钮没有被隐藏?
|