Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP.NET (Non-Forum Related)
 How to show property of custom control in Property
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

GoodMorningSky
Junior Member

122 Posts

Posted - 04 April 2005 :  03:36:14  Show Profile
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

Ghostnetworks
New Member

95 Posts

Posted - 04 April 2005 :  06:32:46  Show Profile  Visit Ghostnetworks's Homepage
Design mode sometimes doesn't show custom controls properly.
Your best option is to run the webform on a test server.

BTW...
It's probably best to use an existing, working control and change it little by little until you have what you want.

http://www.codeproject.com/aspnet/UserControlDesigner.asp

http://www.wimdows.net/articles/article.aspx?aid=7 <-- Probably the best of the two.. Try to work it out from here.
Change it a little, but stop and undo the moment designer mode stops showing it properly. That's when VS can't properly interpret it's appearence in live mode and probably cause other problems during runtime.

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.07 seconds. Powered By: Snitz Forums 2000 Version 3.4.07