GoodMorningSky
Junior Member
122 Posts |
Posted - 04 April 2005 : 03:36:14
|
How to show property of custom control in Property window?
I make Validator : System.Web.UI.WebControls.CustomValidator class. and defined ValidationType property which is type of ValidateType. I want to make the proerty is shown with Extended dropdown menu in properties window of Design mode. I added the validator control to toolbox and droped to WebForm in design mode but, property window doesn't show the property!
I did following but, it doesn't show. How can I do it?
using System; using System.Web.UI; using System.ComponentModel; namespace TestControls { /// <summary> /// Summary description for Validator. /// </summary> [DefaultProperty("ValidationType")] public class Validator : System.Web.UI.WebControls.CustomValidator { public Validator() { } private ValidateType _validateType; [Bindable(true), Browsable(true), Category("Appearance"), TypeConverter(typeof(ValidateType))] public ValidateType ValidationType { set { _validateType = value; switch(_validateType) { case ValidateType.Email: this.ClientValidationFunction="OnValidate_Email"; this.ErrorMessage = "Test Error"; break; } } } } } using System;
namespace TestControls {
public enum ValidateType { Email = 1, Phone = 2, } } [/CODE] |
Software Engineer. MCSD.NET, SCWCD |
|