User control events

Discussion in 'ASP .Net Building Controls' started by Miguel, May 25, 2007.

  1. Miguel

    Miguel Guest

    I have builded some user controls in and works fine. These contros
    have public properties, that I can view and modify at design time in the
    properties panel. Both, properties and events, have the
    [System.ComponentModel.Browsable(true)] attribute.
    But, the events don't appear in de properties panel.

    Also the [System.ComponentModel.DefaultValue("MyValue")] attribute for the
    properties have not effect and I must assign these values at runtime

    Any Idea?

    best regards
    Miguel, May 25, 2007
    1. Advertisements

  2. Miguel

    Bora Guest

    Hi Miguel,

    Just a guess, in propertygrid events are displayed seperately from
    properties (the lightning icon in propertygrid's toolbar). You might be
    missing looking there. If not, would be nice if you send the code you wrote
    for the event.

    In a simple explanation, DevaultValue is used by Visual Studio if to write
    value to aspx page or not. values different than DefaultValue will be
    written to aspx page (which are bold in propertygrid). You should set
    default value by yourself (like below for example.)

    private string myPropertyDefault = "default";
    public string MyProperty
    object o = ViewState["MyProperty"];
    return o==null ? defaultMyProperty : o as string;

    ViewState["MyProperty"] = value;

    Bora, May 26, 2007
    1. Advertisements

  3. Miguel

    Teemu Keiski Guest

    Teemu Keiski, May 26, 2007
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.