Professional Web Applications Themes

Design time "move" and "resize" - ASP.NET Building Controls

I saw the following post on dotnet24x7.com. Usually Victor Garcia Aprea has been pretty helpful. I have a similar issue. I WANT to derive from control, not webcontrol because I don't want all those other properties, only mine. I'm just seeking a little clarification and perhaps a code sample. I've already Implemented IAttributeAccessor. (I got that from microsoft.com when I looked at the class definition for webcontrol) Now what? If I understand this correctly, I need to create 2 properties; 1 called Style As System.Web.UI.WebControls.Style, 1 called CssStyleCollection As System.Web.UI.CssStyleCollection. The other way I understood this portion was to create ...

  1. #1

    Default Re: Design time "move" and "resize"

    I saw the following post on dotnet24x7.com. Usually Victor Garcia Aprea has been pretty helpful.
    I have a similar issue. I WANT to derive from control, not webcontrol because I don't want all those other properties, only mine. I'm just seeking a little clarification and perhaps a code sample. I've already Implemented IAttributeAccessor. (I got that from microsoft.com when I looked at the class definition for webcontrol) Now what?

    If I understand this correctly, I need to create 2 properties; 1 called Style As System.Web.UI.WebControls.Style, 1 called CssStyleCollection As System.Web.UI.CssStyleCollection.

    The other way I understood this portion was to create 1 property; Style As System.Web.UI.CssStyleCollection


    I already have my own properties set up for Height, Width, and TabIndex

    What do I do with the AttributeCollection? Do I make that a public property, or is it just for internal use to be accessed by the GetAttribute and SetAttribute methods?

    Once I implement the style property, will my control automagically be able to pe positioned? If not, then what code do I need to implement that?

    -----------------------------------------------------------------------------------------------------------------------------------------------------------
    -----------------------------------------------------------------------------------------------------------------------------------------------------------

    Hi.
    Because of my project's requirements, I'm building webcontrols deriving
    directly from the
    System.Web.UI.Control class and not from the
    System.Web.UI.WebControls.WebControl class. I cannot change this.
    My problem is that at design time I'm not able to move my controls around on
    the form or resize them.
    How do I provide this functionality, which is available when I inherit from
    the Webcontrol class ?
    Is there an interface to be omplemented or method to be overriden ?

    Thanks a lot!

    Sergio



    Victor Garcia Aprea [noobiesspam.com]
    Hi Sergio,

    You should add to your control the built-in support for Style property that
    the WebControl already implements. If your control support this, you will be
    able to move and resize it using the IDE and also it will display as
    expected when it is rendered. You need to add a basic Style and
    CssStyleCollection properties to hold your control style, also you may want
    to expose additional properties for particular settings (ex. Width, Height,
    etc), you will need to have an AttributeCollection to hold your controls
    attribute and inherit the IAttributeAccesor interface. It will require some
    coding. Can you tell what is the specific reason that you are not allowed to
    inherit from WebControl?

    HTH,
    -Victor.

    -----------------------------------------------------------------------------------------------------------------------------------------------------------
    -----------------------------------------------------------------------------------------------------------------------------------------------------------



    Thanks for any help
    -Rob

    Rob Mayo Guest

  2. #2

    Default Re: Design time "move" and "resize"

    Hi Rob,

    I'm copying here my previous response I just wrote to a similar thread:

    ----
    I tackle this "resizing and moving" deriving from Control, about a year and
    half ago, just as an experiment while learning how the design-time support
    worked.

    The main issue is that the provided designers, when it comes to moving and
    resizing were built for handling with WebControl-derived classes only, you
    can notice that looking at all the explicit checks that ControlDesigner
    makes looking if its designing a WebControl-derived class. This sounds
    pretty logical also, as WebControl offers the minimum required
    functionallity that is needed in order to be moved and resized while Control
    doesn't provide that.

    That said, you *could* actually make some of this stuff work for a
    Control-derived class. I remember having coding a Control-derived class that
    could be resized and it worked okay. But the additional code required isn't
    worth it when compared to inheriting from WebControl (even if you may be
    inheriting some stuff you don't really want). After giving it a shot, I've
    always recommended several times in many posts to inherit from WebControl in
    order to get this funcionallity.

    btw, it has been publicy said that vNext will include some kind of
    intermeditate control between WebControl and Control just to provide this
    functionallity.
    -----

    --
    Victor Garcia Aprea
    Microsoft MVP | ASP.NET
    Looking for insights on ASP.NET? Read my blog:
    [url]http://obies.com/vga/blog.aspx[/url]
    To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
    and not by private mail.

    "Rob Mayo" <Rob.MayoWestonSolutions.com> wrote in message
    news:emS3zLWTDHA.1556TK2MSFTNGP10.phx.gbl...
    I saw the following post on dotnet24x7.com. Usually Victor Garcia Aprea has
    been pretty helpful.
    I have a similar issue. I WANT to derive from control, not webcontrol
    because I don't want all those other properties, only mine. I'm just seeking
    a little clarification and perhaps a code sample. I've already Implemented
    IAttributeAccessor. (I got that from microsoft.com when I looked at the
    class definition for webcontrol) Now what?

    If I understand this correctly, I need to create 2 properties; 1 called
    Style As System.Web.UI.WebControls.Style, 1 called CssStyleCollection As
    System.Web.UI.CssStyleCollection.

    The other way I understood this portion was to create 1 property; Style As
    System.Web.UI.CssStyleCollection


    I already have my own properties set up for Height, Width, and TabIndex

    What do I do with the AttributeCollection? Do I make that a public property,
    or is it just for internal use to be accessed by the GetAttribute and
    SetAttribute methods?

    Once I implement the style property, will my control automagically be able
    to pe positioned? If not, then what code do I need to implement that?

    ----------------------------------------------------------------------------
    ----------------------------------------------------------------------------
    ---
    ----------------------------------------------------------------------------
    ----------------------------------------------------------------------------
    ---

    Hi.
    Because of my project's requirements, I'm building webcontrols deriving
    directly from the
    System.Web.UI.Control class and not from the
    System.Web.UI.WebControls.WebControl class. I cannot change this.
    My problem is that at design time I'm not able to move my controls around on
    the form or resize them.
    How do I provide this functionality, which is available when I inherit from
    the Webcontrol class ?
    Is there an interface to be omplemented or method to be overriden ?

    Thanks a lot!

    Sergio



    Victor Garcia Aprea [noobiesspam.com]
    Hi Sergio,

    You should add to your control the built-in support for Style property that
    the WebControl already implements. If your control support this, you will be
    able to move and resize it using the IDE and also it will display as
    expected when it is rendered. You need to add a basic Style and
    CssStyleCollection properties to hold your control style, also you may want
    to expose additional properties for particular settings (ex. Width, Height,
    etc), you will need to have an AttributeCollection to hold your controls
    attribute and inherit the IAttributeAccesor interface. It will require some
    coding. Can you tell what is the specific reason that you are not allowed to
    inherit from WebControl?

    HTH,
    -Victor.

    ----------------------------------------------------------------------------
    ----------------------------------------------------------------------------
    ---
    ----------------------------------------------------------------------------
    ----------------------------------------------------------------------------
    ---



    Thanks for any help
    -Rob


    Victor Garcia Aprea [MVP] Guest

  3. #3

    Default Re: Design time "move" and "resize"

    That's ok. I don't mind the extra code. I really want to see if I can make
    this derive from Control. My bosses really want users to not be selecting
    properties that the control doesn't use. They feel that's more important
    than any amount of coding we have to do to make that possible. I know it's
    pretty twisted, but that's what they want. Anything you can do to help?

    "Victor Garcia Aprea [MVP]" <vgaNOobiesSPAM.com> wrote in message
    news:OT59GmhTDHA.2512TK2MSFTNGP10.phx.gbl...
    > Hi Rob,
    >
    > I'm copying here my previous response I just wrote to a similar thread:
    >
    > ----
    > I tackle this "resizing and moving" deriving from Control, about a year
    and
    > half ago, just as an experiment while learning how the design-time support
    > worked.
    >
    > The main issue is that the provided designers, when it comes to moving and
    > resizing were built for handling with WebControl-derived classes only, you
    > can notice that looking at all the explicit checks that ControlDesigner
    > makes looking if its designing a WebControl-derived class. This sounds
    > pretty logical also, as WebControl offers the minimum required
    > functionallity that is needed in order to be moved and resized while
    Control
    > doesn't provide that.
    >
    > That said, you *could* actually make some of this stuff work for a
    > Control-derived class. I remember having coding a Control-derived class
    that
    > could be resized and it worked okay. But the additional code required
    isn't
    > worth it when compared to inheriting from WebControl (even if you may be
    > inheriting some stuff you don't really want). After giving it a shot, I've
    > always recommended several times in many posts to inherit from WebControl
    in
    > order to get this funcionallity.
    >
    > btw, it has been publicy said that vNext will include some kind of
    > intermeditate control between WebControl and Control just to provide this
    > functionallity.
    > -----
    >
    > --
    > Victor Garcia Aprea
    > Microsoft MVP | ASP.NET
    > Looking for insights on ASP.NET? Read my blog:
    > [url]http://obies.com/vga/blog.aspx[/url]
    > To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
    > and not by private mail.
    >
    > "Rob Mayo" <Rob.MayoWestonSolutions.com> wrote in message
    > news:emS3zLWTDHA.1556TK2MSFTNGP10.phx.gbl...
    > I saw the following post on dotnet24x7.com. Usually Victor Garcia Aprea
    has
    > been pretty helpful.
    > I have a similar issue. I WANT to derive from control, not webcontrol
    > because I don't want all those other properties, only mine. I'm just
    seeking
    > a little clarification and perhaps a code sample. I've already Implemented
    > IAttributeAccessor. (I got that from microsoft.com when I looked at the
    > class definition for webcontrol) Now what?
    >
    > If I understand this correctly, I need to create 2 properties; 1 called
    > Style As System.Web.UI.WebControls.Style, 1 called CssStyleCollection As
    > System.Web.UI.CssStyleCollection.
    >
    > The other way I understood this portion was to create 1 property; Style As
    > System.Web.UI.CssStyleCollection
    >
    >
    > I already have my own properties set up for Height, Width, and TabIndex
    >
    > What do I do with the AttributeCollection? Do I make that a public
    property,
    > or is it just for internal use to be accessed by the GetAttribute and
    > SetAttribute methods?
    >
    > Once I implement the style property, will my control automagically be able
    > to pe positioned? If not, then what code do I need to implement that?
    >
    > --------------------------------------------------------------------------
    --
    > --------------------------------------------------------------------------
    --
    > ---
    > --------------------------------------------------------------------------
    --
    > --------------------------------------------------------------------------
    --
    > ---
    >
    > Hi.
    > Because of my project's requirements, I'm building webcontrols deriving
    > directly from the
    > System.Web.UI.Control class and not from the
    > System.Web.UI.WebControls.WebControl class. I cannot change this.
    > My problem is that at design time I'm not able to move my controls around
    on
    > the form or resize them.
    > How do I provide this functionality, which is available when I inherit
    from
    > the Webcontrol class ?
    > Is there an interface to be omplemented or method to be overriden ?
    >
    > Thanks a lot!
    >
    > Sergio
    >
    >
    >
    > Victor Garcia Aprea [noobiesspam.com]
    > Hi Sergio,
    >
    > You should add to your control the built-in support for Style property
    that
    > the WebControl already implements. If your control support this, you will
    be
    > able to move and resize it using the IDE and also it will display as
    > expected when it is rendered. You need to add a basic Style and
    > CssStyleCollection properties to hold your control style, also you may
    want
    > to expose additional properties for particular settings (ex. Width,
    Height,
    > etc), you will need to have an AttributeCollection to hold your controls
    > attribute and inherit the IAttributeAccesor interface. It will require
    some
    > coding. Can you tell what is the specific reason that you are not allowed
    to
    > inherit from WebControl?
    >
    > HTH,
    > -Victor.
    >
    > --------------------------------------------------------------------------
    --
    > --------------------------------------------------------------------------
    --
    > ---
    > --------------------------------------------------------------------------
    --
    > --------------------------------------------------------------------------
    --
    > ---
    >
    >
    >
    > Thanks for any help
    > -Rob
    >
    >

    Rob Mayo Guest

Similar Threads

  1. Replies: 1
    Last Post: April 24th, 01:27 PM
  2. CFINPUT type="radio" w/ "value" requires "label"
    By Iceborer in forum Macromedia ColdFusion
    Replies: 2
    Last Post: February 21st, 06:16 PM
  3. #26162 [NEW]: $a="0abcdefg";if ($a==0) echo "OK"; result is "OK" ?!
    By zhuminglun at yahoo dot com dot cn in forum PHP Development
    Replies: 0
    Last Post: November 7th, 12:04 PM
  4. Replies: 0
    Last Post: November 7th, 11:45 AM
  5. "Start" "Program" "Menu" list is empty
    By Pete in forum Windows XP/2000/ME
    Replies: 2
    Last Post: July 10th, 10:42 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139