隐藏和显示服务器端控件以及Html控件
/// <summary> /// 隐藏控件 /// </summary> /// <param name="control"></param> protected void HideControl(Object control) { if (control is WebControl) { ((WebControl)control).Style.Add("display", "none"); } if (control is HtmlControl) { ((HtmlControl)control).Style.Add("display", "none"); } } /// <summary> /// 显示服务器端控件 /// </summary> /// <param name="control"></param> protected void ShowControl(Object control) { if (control is WebControl) { ((WebControl)control).Style.Add("display", ""); } if (control is HtmlControl) { ((HtmlControl)control).Style.Add("display", ""); } }
ok了。