| 在BasePage中重载OnPreRende事件中偷梁换柱,代码如下: protected override void OnPreRender(EventArgs e) { //将所有的TextBox设置ReadOnly=true的文本框,添加"readonly"Html的attribute foreach (System.Web.UI.Control _c in Page.Form.Controls) { if (_c is TextBox) { TextBox _box = (TextBox)_c; if (_box.ReadOnly) { _box.ReadOnly = false; _box.Attributes["readonly"] = "true"; } } } base.OnPreRender(e); } |
相关文章: