ControlToValidate - CheckBoxList
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngcontrolscs' list.


Robm
Hello

I have created a CheckBoxList validator which ensure that the max and min #=
of items have been checked.
Everything works properly, but I would like to be able to select a CheckBox=
List within the ControlToValidate section in the VS.Net properties window. =
Currently, the list that is displayed will only show TextBox's, ListBoxes, =
..., but not CheckBoxList.

I assume this is inherrited from the System.Web.UI.WebControls.BaseValidato=
r class, so does anyone know how to override this feature so that it shows =
CheckBoxLists?

Thanks,

Robert Merriott
.Net Developer

Reply to this message...
 
    
Andy Smith
you'll have to change the UITypeEditor for that property.
I believe it's the Editor attribute applied to the propety.

you could probably inherit from the one the current UITypeEditor to do =
it.

__
Andy Smith
Keyboard Jockey #3a7-2.78.1

[Original message clipped]

Reply to this message...
 
    
Robm
Hey Andy

Thanks for getting back to me.=20
Would you be able to elaborate more on the type that I should be using?

Within my class, I now have the following code...

[Editor(typeof(System.Web.UI.WebControls.CheckBoxList), typeof(System.Drawi=
ng.Design.UITypeEditor))]=20
public string ControlToValidate{
    get{return this.ControlToValidate;}
    set{base.ControlToValidate =3D value;}
}

* Note, I am extending the BaseValidator class

Which throws an exception within VS.Net (Didn't think the CheckBoxList was =
correct, but thought I would try)
Do you know the proper values to place into the Editor section or where I c=
ould find/figure these out?

Thanks,

Robert Merriott
.Net Developer

>>> Click here to reveal e-mail address 08/09/02 10:50AM >>>
you'll have to change the UITypeEditor for that property.
I believe it's the Editor attribute applied to the propety.

you could probably inherit from the one the current UITypeEditor to do it.

__
Andy Smith
Keyboard Jockey #3a7-2.78.1

[Original message clipped]

| [aspngcontrolscs] member Click here to reveal e-mail address =3D YOUR ID
| http://www.asplists.com/asplists/aspngcontrolscs.asp =3D JOIN/QUIT
| http://www.asplists.com/search =3D SEARCH Archives

Reply to this message...
 
    
John John
hi,
the solution is much simpler. you just have to add the
ValidationPropertyAttribute attribute to your class:

    [
    DefaultProperty("Text"),
    ValidationPropertyAttribute("Text")
    ]
    public class EnhLabelEdit : WebControl, IPostBackDataHandler
    {

    }
and yep, I agree, it was not easy to find...
John.

[Original message clipped]

Reply to this message...
 
 
System.Drawing.Design.UITypeEditor
System.Web.UI.IPostBackDataHandler
System.Web.UI.MobileControls.BaseValidator
System.Web.UI.MobileControls.TextBox
System.Web.UI.ValidationPropertyAttribute
System.Web.UI.WebControls.BaseValidator
System.Web.UI.WebControls.CheckBox
System.Web.UI.WebControls.CheckBoxList
System.Web.UI.WebControls.TextBox
System.Web.UI.WebControls.WebControl
System.Windows.Forms.CheckBox
System.Windows.Forms.TextBox




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com