locked
Custom Controls and Intellisense RRS feed

  • Question

  • User-658950549 posted

    Hey all

    I have a custom control (public class XYZ : Control) which I use in some of my asp/cx files.

    This control is pretty big with lots of properties, sub controls and templates.

    VS (2005) stopped giving me Intellisense and I suspect it's about some attributes (PersistenceMode, DesignerSerializationVisibility etc) forgotten for properties.

    Is there a way to know where the VS fails to load the control's schema, and fix it where needed?

     

    Thanks,
    Elad
     

     

    Monday, September 3, 2007 8:52 AM

Answers

  • User135641708 posted

    Well, if the issue is with parsing the control's inner content, then yes, the attributes you mentioned would indeed affect intellisense. DesignerSerializationVisibility merely sets whether to persist a property as a simple string (the default), a complex object, or not persisted at all with values .Visible, .Content, and .Hidden, respectfully.

    PersistenceMode will only affect intellisense by indicating where to persist a property (in an attribute, in an inner tag, or in an inner default tag). Note that when specifying InnerDefaultTag, you must specify ParseChildren(true, "<property name which has that attribute value>") on the control class, to know to parse the inner content directly into the property. Otherwise, ParseChildren(true) is required for intellisense to correspond to property names and PersistChildren(false) for some other things which I'm really not sure of (I've researched the use of PersistChildren without luck, only to settle on the practice to always supply it with a boolean which is an inverse of the one supplied to ParseChildrenAttribute).

    Hope this helps.

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, September 3, 2007 9:08 PM
  • User-658950549 posted

    Hey

    Thanks for the detailed answer.

    Eventually the problem was that <system.web><pages><controls><add/> node was written in a nested web.config file and not in the one in the root.
    VS somehow couldn't find the control in aspx/ascx files and I didn't get intellisense.

    When moved to the web.config in the root, it worked.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, September 10, 2007 7:45 AM

All replies

  • User135641708 posted

    Well, if the issue is with parsing the control's inner content, then yes, the attributes you mentioned would indeed affect intellisense. DesignerSerializationVisibility merely sets whether to persist a property as a simple string (the default), a complex object, or not persisted at all with values .Visible, .Content, and .Hidden, respectfully.

    PersistenceMode will only affect intellisense by indicating where to persist a property (in an attribute, in an inner tag, or in an inner default tag). Note that when specifying InnerDefaultTag, you must specify ParseChildren(true, "<property name which has that attribute value>") on the control class, to know to parse the inner content directly into the property. Otherwise, ParseChildren(true) is required for intellisense to correspond to property names and PersistChildren(false) for some other things which I'm really not sure of (I've researched the use of PersistChildren without luck, only to settle on the practice to always supply it with a boolean which is an inverse of the one supplied to ParseChildrenAttribute).

    Hope this helps.

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, September 3, 2007 9:08 PM
  • User-658950549 posted

    Hey

    Thanks for the detailed answer.

    Eventually the problem was that <system.web><pages><controls><add/> node was written in a nested web.config file and not in the one in the root.
    VS somehow couldn't find the control in aspx/ascx files and I didn't get intellisense.

    When moved to the web.config in the root, it worked.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, September 10, 2007 7:45 AM