all groups > asp.net building controls > january 2006 >
You're in the

asp.net building controls

group:

Refer othr properties in the contrl in getstandardvaluecollection


Refer othr properties in the contrl in getstandardvaluecollection Venkat
1/20/2006 1:46:02 PM
asp.net building controls: 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)?.

RE: Refer othr properties in the contrl in getstandardvaluecollection Venkat
1/20/2006 2:32:02 PM
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




[quoted text, click to view]
AddThis Social Bookmark Button