- 爱易网页
-
ASP.NET教程
- |M| 学写第一个自定义控件的最后一个有关问题:[DefaultProperty("Message")]无效
日期:2014-05-19 浏览次数:20416 次
|M| 学写第一个自定义控件的最后一个问题:[DefaultProperty("Message")]无效
[DefaultProperty( "Message "), ToolboxData( " <{0}:WebRev runat=server /> ")]
我已经定义了属性
[Browsable(true), Themeable(false), Category( "我的属性 "), DefaultValue( "* "), Description( "当焦点在验证控件时显示的信息 ")]
public String Message
{
get { return _Message; }
set { _Message = value; }
}
也就是要当控件拖到设计页面上的时候显示出来的属性值
但我的当不能正常的显示:我贴出所有源码
---------------------------------
using System;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.ComponentModel;
using System.Drawing;
namespace zhang
{
[DefaultProperty( "Message "), ToolboxData( " <{0}:WebRev runat=server /> ")]
[System.Drawing.ToolboxBitmap(typeof(RegularExpressionValidator))]
public class webRev : System.Web.UI.WebControls.WebControl
{
#region 私有变量
String _Message = "* ";
Boolean _AlwaysShow = true;
String _FocusClientScript = " ";
String _BlurClientScript = " ";
Boolean _FieldValidator = true;
String _ErrorMessage = "* ";
String _ValidationExpression = " ";
String _ControlToValidate = " ";
ValidatorDisplay _Display = ValidatorDisplay.Dynamic;
String _NotNullMessage = "* ";
Color _ErrorColor = Color.Red;
Color _NotNullColor = Color.Red;
String _ValidationGroup = " ";
//Color _MessageColor = Color.Red;
#endregion
#region 设计属性
[Browsable(true), Themeable(false), Category( "我的属性 "), DefaultValue( "* "), Description( "当焦点在验证控件时显示的信息 ")]