Professional Web Applications Themes

Collection Property problems with Image control ImageUrl property and URLBuilder - ASP.NET Building Controls

Been using reflector and examining what Microsoft does with the Rows property in the Table class. It looks like all of the items added to the rows collection end up in the Controls collection of the table control. Interesting enough the ControlCollection type has a parent property. My best guess at this point is that I am going to have to modify my Buttons collection to simulate what the Rows collection is doing. I will keep you informed. "Brian" <NobrianpclabSpamadelphia.net> wrote in message news:a-ydney5QKeB1jHdRVn-iQadelphia.com... > It sounded like a good idea at the time but now I don't really think ...

  1. #1

    Default Re: Collection Property problems with Image control ImageUrl property and URLBuilder

    Been using reflector and examining what Microsoft does with the Rows
    property in the Table class. It looks like all of the items added to the
    rows collection end up in the Controls collection of the table control.
    Interesting enough the ControlCollection type has a parent property. My
    best guess at this point is that I am going to have to modify my Buttons
    collection to simulate what the Rows collection is doing. I will keep you
    informed.
    "Brian" <NobrianpclabSpamadelphia.net> wrote in message
    news:a-ydney5QKeB1jHdRVn-iQadelphia.com...
    > It sounded like a good idea at the time but now I don't really think so
    and
    > I acknowledge that templates might be a better way to go. But...
    >
    > I created a server control named (NavigationSection2) with a collection
    > property named Buttons. The idea was to use the collection editor and the
    > property grid
    > to add custom button controls into this collection. At run time the
    buttons
    > would simply be rendered within a centered table.
    >
    > (NOTE for the attached code I used the System.Web.UI.WebControls.Image
    > control to show the problem rather than buttons.)
    >
    > The server control does not work properly in the Designer with the Image
    > control. The problem is with the ImageUrl property of the image control.
    > All properties of the control can be set in the propertygrid when it is
    > first dropped onto the form including the ImageUrl property.
    > However when you switch between Design and HTML view you will no longer be
    > able to edit the ImageUrl property when you go back into the collection
    and
    > select an image control to edit.
    >
    > I found a post
    > [url]http://www.artima.com/forums/flat.jsp?forum=152&thread=38250[/url]
    > That implies that the problem is with the URLBuilder and the fact that the
    > collection housing the control is not Sited.
    > I tried the solution given in the post and it still does not work. My
    guess
    > for this not working is that my NavigationSection2 control is no longer
    > sited when you switch
    > between HTML and Design mode which means that keeping track of the parent
    in
    > the collection will not work.
    >
    > I would really like to get this solution to work because it is the basis
    of
    > many of the other controls I plan to create.
    > Actual code is attached simply place the .cs file in a Web Control Library
    > project and create a ASP Web project that uses the control.
    >
    > Thanks
    > Brian
    > .
    >
    >
    >
    >

    Brian Guest

  2. #2

    Default Re: Collection Property problems with Image control ImageUrl property and URLBuilder

    OK what I have discovered so far is this.
    1. There is a problem with my Visual Studio 2003 IDE. No collection editor
    of any type works.. I have confirmed that this is ONLY on my PC and not on
    the other 4 that I installed the controls on. I have already tried a
    reinstall of 2003 and that did not solve
    the problem so I am looking at a rebuild of the OS later this week. So that
    this means is that the collection properties work as expected and that the
    problem was in my Visual Studio IDE.
    2. There IS a problem using collection properties that hold one or more
    System.Web.UI.Image controls.
    I have managed to work around this issue by combining the post from
    Artima.com with using the Controls collection to hold the data.

    Because I am now 2 weeks behind on this project when I get more time I will
    write a comprehensive response.
    Brian

    "Brian" <NobrianpclabSpamadelphia.net> wrote in message
    news:uyJrWk7PEHA.3908TK2MSFTNGP09.phx.gbl...
    > Been using reflector and examining what Microsoft does with the Rows
    > property in the Table class. It looks like all of the items added to the
    > rows collection end up in the Controls collection of the table control.
    > Interesting enough the ControlCollection type has a parent property. My
    > best guess at this point is that I am going to have to modify my Buttons
    > collection to simulate what the Rows collection is doing. I will keep you
    > informed.
    > "Brian" <NobrianpclabSpamadelphia.net> wrote in message
    > news:a-ydney5QKeB1jHdRVn-iQadelphia.com...
    > > It sounded like a good idea at the time but now I don't really think so
    > and
    > > I acknowledge that templates might be a better way to go. But...
    > >
    > > I created a server control named (NavigationSection2) with a collection
    > > property named Buttons. The idea was to use the collection editor and
    the
    > > property grid
    > > to add custom button controls into this collection. At run time the
    > buttons
    > > would simply be rendered within a centered table.
    > >
    > > (NOTE for the attached code I used the System.Web.UI.WebControls.Image
    > > control to show the problem rather than buttons.)
    > >
    > > The server control does not work properly in the Designer with the Image
    > > control. The problem is with the ImageUrl property of the image
    control.
    > > All properties of the control can be set in the propertygrid when it is
    > > first dropped onto the form including the ImageUrl property.
    > > However when you switch between Design and HTML view you will no longer
    be
    > > able to edit the ImageUrl property when you go back into the collection
    > and
    > > select an image control to edit.
    > >
    > > I found a post
    > > [url]http://www.artima.com/forums/flat.jsp?forum=152&thread=38250[/url]
    > > That implies that the problem is with the URLBuilder and the fact that
    the
    > > collection housing the control is not Sited.
    > > I tried the solution given in the post and it still does not work. My
    > guess
    > > for this not working is that my NavigationSection2 control is no longer
    > > sited when you switch
    > > between HTML and Design mode which means that keeping track of the
    parent
    > in
    > > the collection will not work.
    > >
    > > I would really like to get this solution to work because it is the basis
    > of
    > > many of the other controls I plan to create.
    > > Actual code is attached simply place the .cs file in a Web Control
    Library
    > > project and create a ASP Web project that uses the control.
    > >
    > > Thanks
    > > Brian
    > > .
    > >
    > >
    > >
    > >
    >
    >

    BMukes Guest

  3. #3

    Default Re: Collection Property problems with Image control ImageUrl property and URLBuilder

    Brian hi,

    Do you persist collection data that your user adds? I'm using
    PChildren(true,"CollectionAttributeName"),
    PersistChildren(false) attributes to persist the edit data as sub HTML
    tags and don't have any problems. If you want send me mail and I'll send
    you sample code of control that use custom UITypeEditor to edit
    collection data and persist collection data as sub HTML tags.

    natty[at]dao2com[dot]com.

    HTH

    Natty Gur[MVP]

    blog : [url]http://weblogs.asp.net/ngur[/url]
    Mobile: +972-(0)58-888377




    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Natty Gur Guest

Similar Threads

  1. Collection Property in web custom control
    By Class in forum ASP.NET
    Replies: 1
    Last Post: January 17th, 01:27 PM
  2. Custom Control - Collection Property
    By Synced in forum ASP.NET
    Replies: 1
    Last Post: January 17th, 03:33 AM
  3. Replies: 0
    Last Post: April 6th, 11:13 PM
  4. Replies: 0
    Last Post: May 20th, 06:19 AM
  5. Custom Control nad Collection property
    By Brian Bugge in forum ASP.NET Building Controls
    Replies: 0
    Last Post: July 2nd, 02:09 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