using the Items property in the design time property window

Discussion in 'ASP .Net Building Controls' started by Ryan Taylor, Feb 8, 2005.

  1. Ryan Taylor

    Ryan Taylor Guest

    I hope this is the proper forum. I posted this problem in the wrong one
    previously. I have a custom server control that I am building. Implementing
    simple properties like strings and ints seems to be pretty straightforward
    and there are a lot of examples. However, I have a need to allow the user to
    add multiple items. Each item would be a custom class that contains a few
    properties, id, name etc. I cannot seem to get this functionality to work,
    and I cannot find any examples anywhere, I've been googling forever.

    Ultimately, my goal is to create a custom server control, that renders out
    images with javascript. An additional "action" parameter on each item would
    determine the action that the javascript executes. And I want the designer
    to be able to configure the control at design time through the Items
    property.

    Any assistance would be appreciated very much.
    Ryan
     
    Ryan Taylor, Feb 8, 2005
    #1
    1. Advertising

  2. Ryan Taylor

    Chad Guest

    Ryan,

    I'm sorry I don't have the answer, but I'm in the same boat. The native
    types like string and ints seem to be handled correctly. But I've got a
    property that holds a string array and a property that points to
    another control. I can fill these properties in at design time, but
    when I run the values in the properties are lost. Which I think is the
    same problem you are having. Yep lots of examples on properties of
    strings and ints, but I've been looking as well for a more complicated
    example and don't see any. Hopefully there will be some reading that
    has the answer. If you find the answer please post back to let me know.

    Thanks ...


    Ryan Taylor wrote:
    > I hope this is the proper forum. I posted this problem in the wrong

    one
    > previously. I have a custom server control that I am building.

    Implementing
    > simple properties like strings and ints seems to be pretty

    straightforward
    > and there are a lot of examples. However, I have a need to allow the

    user to
    > add multiple items. Each item would be a custom class that contains a

    few
    > properties, id, name etc. I cannot seem to get this functionality to

    work,
    > and I cannot find any examples anywhere, I've been googling forever.
    >
    > Ultimately, my goal is to create a custom server control, that

    renders out
    > images with javascript. An additional "action" parameter on each item

    would
    > determine the action that the javascript executes. And I want the

    designer
    > to be able to configure the control at design time through the Items
    > property.
    >
    > Any assistance would be appreciated very much.
    > Ryan
     
    Chad, Feb 8, 2005
    #2
    1. Advertising

  3. Ryan Taylor

    Ryan Taylor Guest

    Chad,

    I haven't even gotten this far. I have managed to add one custom item
    through the property window, but that is it. The Add/Remove buttons are then
    disabled. If I close the property window, they are still disabled, and there
    doesn't appear to be an item in the members list, however, one item shows in
    the right in the properties list. Very strange.

    Do you have an example of how you got where you are?
    I am not sure what I am missing, documentation in this area is so scarce.

    "Chad" <> wrote in message
    news:...
    > Ryan,
    >
    > I'm sorry I don't have the answer, but I'm in the same boat. The native
    > types like string and ints seem to be handled correctly. But I've got a
    > property that holds a string array and a property that points to
    > another control. I can fill these properties in at design time, but
    > when I run the values in the properties are lost. Which I think is the
    > same problem you are having. Yep lots of examples on properties of
    > strings and ints, but I've been looking as well for a more complicated
    > example and don't see any. Hopefully there will be some reading that
    > has the answer. If you find the answer please post back to let me know.
    >
    > Thanks ...
    >
    >
    > Ryan Taylor wrote:
    > > I hope this is the proper forum. I posted this problem in the wrong

    > one
    > > previously. I have a custom server control that I am building.

    > Implementing
    > > simple properties like strings and ints seems to be pretty

    > straightforward
    > > and there are a lot of examples. However, I have a need to allow the

    > user to
    > > add multiple items. Each item would be a custom class that contains a

    > few
    > > properties, id, name etc. I cannot seem to get this functionality to

    > work,
    > > and I cannot find any examples anywhere, I've been googling forever.
    > >
    > > Ultimately, my goal is to create a custom server control, that

    > renders out
    > > images with javascript. An additional "action" parameter on each item

    > would
    > > determine the action that the javascript executes. And I want the

    > designer
    > > to be able to configure the control at design time through the Items
    > > property.
    > >
    > > Any assistance would be appreciated very much.
    > > Ryan

    >
     
    Ryan Taylor, Feb 8, 2005
    #3
  4. Ryan Taylor

    Paul Louth Guest

    Hi Ryan, Chad, unfortunately I don't have the answer either, and am in the
    same boat. I posted another topic before seeing yours titled: "Collections
    as properties".

    I have got as far as creating a control which I can add multiple items to in
    the designer, but when I switch to the HTML view the value is "(Container)".
    Which looks like a ToString() returned value. So I'm wondering whether the
    container should serialise the items, but I am really clutching at straws
    atm.

    Paul.


    "Ryan Taylor" <> wrote in message
    news:%...
    > Chad,
    >
    > I haven't even gotten this far. I have managed to add one custom item
    > through the property window, but that is it. The Add/Remove buttons are
    > then
    > disabled. If I close the property window, they are still disabled, and
    > there
    > doesn't appear to be an item in the members list, however, one item shows
    > in
    > the right in the properties list. Very strange.
    >
    > Do you have an example of how you got where you are?
    > I am not sure what I am missing, documentation in this area is so scarce.
    >
    > "Chad" <> wrote in message
    > news:...
    >> Ryan,
    >>
    >> I'm sorry I don't have the answer, but I'm in the same boat. The native
    >> types like string and ints seem to be handled correctly. But I've got a
    >> property that holds a string array and a property that points to
    >> another control. I can fill these properties in at design time, but
    >> when I run the values in the properties are lost. Which I think is the
    >> same problem you are having. Yep lots of examples on properties of
    >> strings and ints, but I've been looking as well for a more complicated
    >> example and don't see any. Hopefully there will be some reading that
    >> has the answer. If you find the answer please post back to let me know.
    >>
    >> Thanks ...
    >>
    >>
    >> Ryan Taylor wrote:
    >> > I hope this is the proper forum. I posted this problem in the wrong

    >> one
    >> > previously. I have a custom server control that I am building.

    >> Implementing
    >> > simple properties like strings and ints seems to be pretty

    >> straightforward
    >> > and there are a lot of examples. However, I have a need to allow the

    >> user to
    >> > add multiple items. Each item would be a custom class that contains a

    >> few
    >> > properties, id, name etc. I cannot seem to get this functionality to

    >> work,
    >> > and I cannot find any examples anywhere, I've been googling forever.
    >> >
    >> > Ultimately, my goal is to create a custom server control, that

    >> renders out
    >> > images with javascript. An additional "action" parameter on each item

    >> would
    >> > determine the action that the javascript executes. And I want the

    >> designer
    >> > to be able to configure the control at design time through the Items
    >> > property.
    >> >
    >> > Any assistance would be appreciated very much.
    >> > Ryan

    >>

    >
    >
     
    Paul Louth, Feb 17, 2005
    #4
  5. Ryan Taylor

    Paul Louth Guest

    Ok, found how to do it, you need to set the PersistenceMode attribute to
    InnerProperty for the property you want embedding:

    [Bindable(true), PersistenceMode(PersistenceMode.InnerProperty)]
    public YourCollection Collection
    {
    get {}
    set {}
    }

    Paul
     
    Paul Louth, Feb 18, 2005
    #5
    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. Saimeera
    Replies:
    0
    Views:
    519
    Saimeera
    May 10, 2006
  2. flamesrock
    Replies:
    8
    Views:
    519
    Hendrik van Rooyen
    Nov 24, 2006
  3. Ben
    Replies:
    2
    Views:
    937
  4. Frederic Goulet

    Design-time DataList 5 items

    Frederic Goulet, Feb 20, 2004, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    180
    Frederic Goulet
    Feb 22, 2004
  5. Jim

    Design-time duplication of list items

    Jim, Jan 20, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    145
Loading...

Share This Page