Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Server Control Custom Properties Order

Reply
Thread Tools

Server Control Custom Properties Order

 
 
todd.freed@gmail.com
Guest
Posts: n/a
 
      07-07-2006
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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Making Custom Control Properties Visible in Visual Studio's Properties Palette Nathan Sokalski ASP .Net Web Controls 0 10-17-2005 02:05 AM
Making Custom Control Properties Visible in Visual Studio's Properties Palette Nathan Sokalski ASP .Net 0 10-17-2005 02:05 AM
Making Custom Control Properties Visible in Visual Studio's Properties Palette Nathan Sokalski ASP .Net Building Controls 0 10-17-2005 02:05 AM
ControlDesigner not invoked on custom control when control is rendered within another custom control Matt Sokol ASP .Net Building Controls 2 08-07-2003 07:13 AM
How to Display DropDownList with preserved order (custom order) cspoh ASP .Net Web Controls 0 07-31-2003 09:19 AM



Advertisments