|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Web Custom Control using a property displaying current form text boxesI'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. 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 > > > I think you're on to something ...
I'll head down this path. 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 >> >> >> > > 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 >>> >>> >>> >> >> > >
Is someone willing to help me with a simple VB example?
Skin and custom controls (ASP 2.0) ASP.net datagrid with more than 1 datasource Datagrid - How to format EditCommandColumn? SortCommand and custom headers - why won't they play nice? Dynamically populating and expanding TreeView from button click... Composite Web Control Odd Dropdownlist problem Open Source or Free PDF Control Panel limitations? |
|||||||||||||||||||||||