Server Control Custom Properties Order

Discussion in 'ASP .Net' started by todd.freed@gmail.com, Jul 7, 2006.

  1. Guest

    Hello. I'll make this quick - its quite a conundrum

    I have the following markup

    <MyNS:MyControl runat="server" id="myId"
    CustomProperty1="value"
    CustomProperty1="value"
    CustomProperty1="value" >
    <Columns>
    <CustomColumnType1 value1="value" value2="value"/>
    <CustomColumnType2 value1="value" value2="value"/>
    <CustomColumnType3 value1="value" value2="value"/>
    <CustomColumnType2 value1="value" value2="value"/>
    <CustomColumnType1 value1="value" value2="value"/>
    </Columns>
    </MyNS:MyControl>

    This is a control I have written which inherits from WebControl. Each
    of the 'CustomProperty's correspond to properties of my control. It
    also has a 'Columns' property which corresponds to the XML-ish markup
    between the opening/closing tags of the control declaration. The
    Columns property is an object of type ColumnList. The ColumnList class
    has several properties which each correspond to the CustomColumnTypes
    as you see here. The CustomColumnTypes have several properties which
    correspond to the values I have indicated above.

    Now- the preceeding worked splendidly until today. Basically, each of
    the CustomColumns gets added to a collection which belongs to the
    ColumnList class. Then OnRender I do some things and emit some nice
    HTML to the page; great.

    However, today we converted our whole project to ASP.Net 2.0 and Visual
    Studio 2005. Yay. Problem is, now, the properties corresponding to
    CustomColumnType are being accessed in what appears to be a random
    order. This is a problem because the CustomColumns are being added in
    an incorrect order (used to be simple top-down) and the net result is
    that the columns that are being displayed on the client are in a random
    order, instead of the order in which they are defined in the control
    declaration. When I Render the HTML I am simply looping over the
    Columns collection from 0 until x, so the order is very important.

    Possible solution: you could assign an "order" property to each column
    declaration, then I could loop over the collection in that order.
    However- this is a massive hack and I just cant bring myself to do it.

    Any help much appreciated.
     
    , Jul 7, 2006
    #1
    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. Nathan Sokalski
    Replies:
    0
    Views:
    956
    Nathan Sokalski
    Oct 17, 2005
  2. Harlan Messinger
    Replies:
    0
    Views:
    389
    Harlan Messinger
    Feb 18, 2008
  3. Nathan Sokalski
    Replies:
    0
    Views:
    229
    Nathan Sokalski
    Oct 17, 2005
  4. cspoh
    Replies:
    0
    Views:
    270
    cspoh
    Jul 31, 2003
  5. Nathan Sokalski
    Replies:
    0
    Views:
    246
    Nathan Sokalski
    Oct 17, 2005
Loading...

Share This Page