用动态控件模拟复合控件(一)
作者 佚名技术
来源 NET编程
浏览
发布时间 2012-05-19
ummary> /// 出错提示时使用的控件ID的中文名字 /// </summary> public String DisplayName { get { if (string.IsNullOrEmpty(this.displayName)) return this.ID; return displayName; } set { displayName = value; } } private string example = string.Empty; /// <summary> /// 示例文本 /// </summary> public string Example { get { return example; } set { example = value; } } protected string GetExampleString() { return string.IsNullOrEmpty(this.Example) ? string.Empty : string.Format("示例:{0}", this.Example); } private TextBoxOptions options = TextBoxOptions.None; /// <summary> /// 文本框选项 /// </summary> public TextBoxOptions Options { get { return options; } set {options =value;} } protected void AddValidator(BaseValidator validator) { //注册 validator.CssClass = "errormessage"; validator.Display = this.ValidatorDisplay; validator.ValidationGroup = this.ValidatorGroup; this.OnAddValidator(this.ParentWrap, validator); ParentWrap.Controls.Add(validator); } protected void AddValidator(ExtenderControlBase validator) { this.OnAddValidator(this.ParentWrap, validator); ParentWrap.Controls.Add(validator); } protected virtual void OnAddValidator(Panel panelParent, BaseValidator validator) { } protected virtual void OnAddValidator(Panel panelParent, ExtenderControlBase validator) { } private void AddHelpMessage() { string helpMessage = this.GetHelpMessage(); if (!string.IsNullOrEmpty(helpMessage.Trim())) { Label msg = new Label() { EnableViewState = false, Text = this.GetHelpMessage(), CssClass = "helpmessage" }; msg.ID = "help_" + this.ID; //msg.Style.Add("display","none"); ParentWrap.Controls.Add(msg); ScriptManager.RegisterStartupScript(this, this.GetType(), this.ClientID + "_help_message", string.Format("evlon.facade.textbox.help_message.add(''{0}'',''{1}'');", this.ClientID, msg.ClientID), true); ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "error_message", "evlon.facade.textbox.clearErrorMessageStyle();", true); } } protected virtual void BuildValidatorControls() { if ((this.Options & TextBoxOptions.Required) == TextBoxOptions.Required) { RequiredFieldValidator rfv = new RequiredFieldValidator(); rfv.ID = "rfv_" + this.ID |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
关于用动态控件模拟复合控件(一)的所有评论