Property Extender properties not persisting !

Discussion in 'ASP .Net Web Controls' started by JezB, Jun 22, 2004.

  1. JezB

    JezB Guest

    I've written an extender provider for windows forms controls and ASP.NET web
    controls. My windows forms solution works fine, but my ASP.NET solution does
    not persist any property values I enter via the visual studio property grid.

    Upon examination of the code within InitializeComponent I can see why : no
    code is automatically embedded to call the Set method of my property.

    Anyone have any ideas why ? Is there any solution ?

    ____________________________________________________________________
    using System;
    using System.ComponentModel;
    using System.Collections;
    using System.Diagnostics;
    using System.Web.UI.WebControls;
    namespace WorkPlace.Presentation.WebLib
    {
    [ProvideProperty("Key",typeof(WebControl))]
    public class FlavourPropertiesExtender :
    System.ComponentModel.Component,
    IExtenderProvider
    {
    private System.ComponentModel.Container components = null;
    private Hashtable keys;
    public FlavourPropertiesExtender(System.ComponentModel.IContainer
    container)
    {
    container.Add(this);
    InitializeComponent();
    }

    public FlavourPropertiesExtender()
    {
    keys = new Hashtable();
    }

    [Category("Key Configuration")]
    public string GetKey(WebControl c)
    {
    string text = (string)keys[c];
    if (text == null)
    {
    text = c.ID;
    }
    return text;
    }
    public void SetKey(WebControl c, string value)
    {
    if (value == null)
    value = string.Empty;
    if (value.Length == 0)
    keys.Remove(c);
    else
    keys[c] = value;
    }

    #region Component Designer generated code
    private void InitializeComponent()
    {
    components = new System.ComponentModel.Container();
    }
    #endregion

    #region IExtenderProvider Members
    public bool CanExtend(object extendee)
    {
    return (extendee is WebControl);
    }
    #endregion
    }
    }
    JezB, Jun 22, 2004
    #1
    1. Advertising

  2. I'm not sure but it looks like you have a similar issue to me... The URL i
    posted in my request for help tackles it a different way. I can get it to
    persist Ok, but it won't set itself correctly.

    Anyway, check out my recently posted message as it 'might' give you some
    idea's.

    Oh btw, in ASP.NET it stores property values in the HTML not the page like
    it does with WinForms, so you should see attributes in your HTML for the
    properties (its so late bound!).

    Garry Mc

    "JezB" <> wrote in message
    news:%...
    > I've written an extender provider for windows forms controls and ASP.NET

    web
    > controls. My windows forms solution works fine, but my ASP.NET solution

    does
    > not persist any property values I enter via the visual studio property

    grid.
    >
    > Upon examination of the code within InitializeComponent I can see why : no
    > code is automatically embedded to call the Set method of my property.
    >
    > Anyone have any ideas why ? Is there any solution ?
    >
    Garry McGlennon, Jun 24, 2004
    #2
    1. Advertising

  3. JezB

    JezB Guest

    ok thanks - i'll take a look

    "Garry McGlennon" <> wrote in message
    news:%...
    > I'm not sure but it looks like you have a similar issue to me... The URL i
    > posted in my request for help tackles it a different way. I can get it to
    > persist Ok, but it won't set itself correctly.
    >
    > Anyway, check out my recently posted message as it 'might' give you some
    > idea's.
    >
    > Oh btw, in ASP.NET it stores property values in the HTML not the page like
    > it does with WinForms, so you should see attributes in your HTML for the
    > properties (its so late bound!).
    >
    > Garry Mc
    >
    > "JezB" <> wrote in message
    > news:%...
    > > I've written an extender provider for windows forms controls and ASP.NET

    > web
    > > controls. My windows forms solution works fine, but my ASP.NET solution

    > does
    > > not persist any property values I enter via the visual studio property

    > grid.
    > >
    > > Upon examination of the code within InitializeComponent I can see why :

    no
    > > code is automatically embedded to call the Set method of my property.
    > >
    > > Anyone have any ideas why ? Is there any solution ?
    > >

    >
    >
    JezB, Jun 24, 2004
    #3
  4. JezB

    Guest

    Gary -

    I'm having an issue with persistence in a webform provider. I'm
    wondering if it sounds like the same problem you had. I've added some
    add'l properties to textBox webcontrols. The properies show up and can
    be set in the designer. However, if I run the aspx page through the
    web, all the new attribute settings disappear.

    Another way this shows up is if you set the property values in the
    designer, save/close the aspx page and then reopen the aspx page, all
    the property values are reset to default.

    If this is the same problem, how did you resolve it? It seems really
    strange how little info is out there reguarding webcontrol providers...

    Garry McGlennon wrote:
    > I'm not sure but it looks like you have a similar issue to me... The

    URL i
    > posted in my request for help tackles it a different way. I can get

    it to
    > persist Ok, but it won't set itself correctly.
    >
    > Anyway, check out my recently posted message as it 'might' give you

    some
    > idea's.
    >
    > Oh btw, in ASP.NET it stores property values in the HTML not the page

    like
    > it does with WinForms, so you should see attributes in your HTML for

    the
    > properties (its so late bound!).
    >
    > Garry Mc
    >
    > "JezB" <> wrote in message
    > news:%...
    > > I've written an extender provider for windows forms controls and

    ASP.NET
    > web
    > > controls. My windows forms solution works fine, but my ASP.NET

    solution
    > does
    > > not persist any property values I enter via the visual studio

    property
    > grid.
    > >
    > > Upon examination of the code within InitializeComponent I can see

    why : no
    > > code is automatically embedded to call the Set method of my

    property.
    > >
    > > Anyone have any ideas why ? Is there any solution ?
    > >
    , Nov 4, 2004
    #4
    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. JezB
    Replies:
    1
    Views:
    354
  2. Alessandro Zifiglio

    Persisting properties in templates and not the control itself

    Alessandro Zifiglio, Nov 9, 2003, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    165
    Alessandro Zifiglio
    Nov 9, 2003
  3. Phillyboy123

    Complex properties (Button) not persisting in webcontrol

    Phillyboy123, Nov 18, 2003, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    168
    Sam Fields
    Jan 15, 2004
  4. *no spam*

    Values not persisting in extender provider

    *no spam*, Oct 28, 2004, in forum: ASP .Net Building Controls
    Replies:
    5
    Views:
    182
  5. Garry McGlennon

    Persisting properties in property Grid (help!)

    Garry McGlennon, Jun 24, 2004, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    127
    Garry McGlennon
    Jun 24, 2004
Loading...

Share This Page