Refer othr properties in the contrl in getstandardvaluecollection

Discussion in 'ASP .Net Building Controls' started by Venkat, Jan 20, 2006.

  1. Venkat

    Venkat Guest

    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
    Venkat, Jan 20, 2006
    #1
    1. Advertising

  2. Venkat

    Venkat Guest

    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




    "Venkat" wrote:

    > 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
    Venkat, Jan 20, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nathan Sokalski
    Replies:
    0
    Views:
    909
    Nathan Sokalski
    Oct 17, 2005
  2. Web Search Store
    Replies:
    11
    Views:
    476
    Web Search Store
    Apr 23, 2008
  3. Aiver

    Can other C# contrl display HTML without WebBrowser?

    Aiver, Mar 13, 2008, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    403
    Peter Bucher [MVP]
    Mar 13, 2008
  4. Web Search Store

    is there a way to refer to public properties in other user controls

    Web Search Store, Apr 21, 2008, in forum: ASP .Net Web Controls
    Replies:
    11
    Views:
    240
    Web Search Store
    Apr 23, 2008
  5. Web Search Store

    is there a way to refer to public properties in other user controls

    Web Search Store, Apr 21, 2008, in forum: ASP .Net Web Services
    Replies:
    11
    Views:
    244
    Web Search Store
    Apr 23, 2008
Loading...

Share This Page