Home All Groups Group Topic Archive Search About

Web Custom Control using a property displaying current form text boxes

Author
15 Jun 2005 7:04 PM
Jay Douglas
I'm trying to add a property to  a Web Custom Control that behaves just like
the ControlToValidate string property on the built in .net valuators.  I
basically want the list to show the various different textboxes on the
current web form.

I've searched, and searched, and can not find an answer.

A link, or any help is appreciated.

Thanks in advance.

--
Jay Douglas
http://jaydouglas.com

Author
15 Jun 2005 8:51 PM
Tom
Just a thought :

Implement a custom editor (look in MSDN for UITypeEditor)
and attach it to to the Property with the EditorAttribute.

Override EditValue in your Editor :
    public virtual object EditValue(ITypeDescriptorContext context,
IServiceProvider provider, object value);

The Instance Property of the context should point to your control :
    MyControl ctrl = (MyControl) context.Instance;

With a reference to the control you should be able to iterate through the
controls in your page :
    foreach (Control pageControl in ctrl.Page.Controls)
    .....


HTH
Tom



Show quoteHide quote
"Jay Douglas" <jayREMOVEIFNOTSPAM@squarei.com> wrote in message
news:%23iprcxdcFHA.1504@TK2MSFTNGP15.phx.gbl...
> I'm trying to add a property to  a Web Custom Control that behaves just
> like
> the ControlToValidate string property on the built in .net valuators.  I
> basically want the list to show the various different textboxes on the
> current web form.
>
> I've searched, and searched, and can not find an answer.
>
> A link, or any help is appreciated.
>
> Thanks in advance.
>
> --
> Jay Douglas
> http://jaydouglas.com
>
>
>
Author
15 Jun 2005 9:17 PM
Jay Douglas
I think you're on to something ...

I'll head down this path.

--
Jay Douglas
http://jaydouglas.com


Show quoteHide quote
"Tom" <t**@davoid.net> wrote in message
news:OzfPjtecFHA.2984@TK2MSFTNGP15.phx.gbl...
> Just a thought :
>
> Implement a custom editor (look in MSDN for UITypeEditor)
> and attach it to to the Property with the EditorAttribute.
>
> Override EditValue in your Editor :
>    public virtual object EditValue(ITypeDescriptorContext context,
> IServiceProvider provider, object value);
>
> The Instance Property of the context should point to your control :
>    MyControl ctrl = (MyControl) context.Instance;
>
> With a reference to the control you should be able to iterate through the
> controls in your page :
>    foreach (Control pageControl in ctrl.Page.Controls)
>    .....
>
>
> HTH
> Tom
>
>
>
> "Jay Douglas" <jayREMOVEIFNOTSPAM@squarei.com> wrote in message
> news:%23iprcxdcFHA.1504@TK2MSFTNGP15.phx.gbl...
>> I'm trying to add a property to  a Web Custom Control that behaves just
>> like
>> the ControlToValidate string property on the built in .net valuators.  I
>> basically want the list to show the various different textboxes on the
>> current web form.
>>
>> I've searched, and searched, and can not find an answer.
>>
>> A link, or any help is appreciated.
>>
>> Thanks in advance.
>>
>> --
>> Jay Douglas
>> http://jaydouglas.com
>>
>>
>>
>
>
Author
15 Jun 2005 9:54 PM
Tom
I guess it's even simpler :

I had a fast look with Reflector (http://www.aisto.com/roeder/dotnet/) at
the Validation controls.
Microsoft didn't use an UITypeEditor for displaying the controls on the
page, they use a custom TypeConverter.
I recommend to get Reflector and have a look at the class
"ValidatedControlConverter".
I think, you can copy / paste most of the code from this class into your own
TypeConverter and you're done....

Regards,
Tom



Show quoteHide quote
"Jay Douglas" <jayREMOVEIFNOTSPAM@squarei.com> wrote in message
news:emgXM7ecFHA.3036@TK2MSFTNGP10.phx.gbl...
>I think you're on to something ...
>
> I'll head down this path.
>
> --
> Jay Douglas
> http://jaydouglas.com
>
>
> "Tom" <t**@davoid.net> wrote in message
> news:OzfPjtecFHA.2984@TK2MSFTNGP15.phx.gbl...
>> Just a thought :
>>
>> Implement a custom editor (look in MSDN for UITypeEditor)
>> and attach it to to the Property with the EditorAttribute.
>>
>> Override EditValue in your Editor :
>>    public virtual object EditValue(ITypeDescriptorContext context,
>> IServiceProvider provider, object value);
>>
>> The Instance Property of the context should point to your control :
>>    MyControl ctrl = (MyControl) context.Instance;
>>
>> With a reference to the control you should be able to iterate through the
>> controls in your page :
>>    foreach (Control pageControl in ctrl.Page.Controls)
>>    .....
>>
>>
>> HTH
>> Tom
>>
>>
>>
>> "Jay Douglas" <jayREMOVEIFNOTSPAM@squarei.com> wrote in message
>> news:%23iprcxdcFHA.1504@TK2MSFTNGP15.phx.gbl...
>>> I'm trying to add a property to  a Web Custom Control that behaves just
>>> like
>>> the ControlToValidate string property on the built in .net valuators.  I
>>> basically want the list to show the various different textboxes on the
>>> current web form.
>>>
>>> I've searched, and searched, and can not find an answer.
>>>
>>> A link, or any help is appreciated.
>>>
>>> Thanks in advance.
>>>
>>> --
>>> Jay Douglas
>>> http://jaydouglas.com
>>>
>>>
>>>
>>
>>
>
>