Refer othr properties in the contrl in getstandardvaluecollection

V

Venkat

Hi

I am writing a webcontrol, that has two properties, both are strings. Based
on the value of the first property, I want set the default values of the
second property. I am trying to set the default values of the second property
using typeconverter that inherits stringconverter and overriding
GetStandardValueCollection. In the method GetStandardValueCollection , How do
I referece prop1 (use the value of prop1)?.

Thanks
 
V

Venkat

Here is the example of what I am trying to accomplish

public class TestControl :WebControl {

private string _firstprop;
private string _secondprop;

[Category("Default")]
public string FirstProperty {
get { return _firstprop;}
set { this._firstprop=value;}
}


[TypeConverter(typeof(CusPropConverter)),
Category("Default")]
public string SecondProperty {
get { return _secondprop;}
set { this._secondprop=value;}
}














internal class CusPropConverter : StringConverter {



public override bool GetStandardValuesSupported(
ITypeDescriptorContext context) {
return true;
}

public override bool GetStandardValuesExclusive(
ITypeDescriptorContext context) {
// returning false here means the property will
// have a drop down and a value that can be manually
// entered.
return false;
}

public override StandardValuesCollection GetStandardValues(
ITypeDescriptorContext context) {


///Here I want to get the value of FirstProp and use to create a array of
strings



return ;

}


}


Can you please guide me how to do it?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top