Problem with order that properties are set from aspx page

C

cope.andrew

Hi

I've developed an ASP.NET server control with 2 properties, PropertyA
and PropertyB. The setter for PropertyB uses the value of PropertyA to
perform some checking when set at designtime.

When the aspx page is opened in the designer, the properties are read
in from the aspx markup but the order the properties are set can't be
guarenteed. Sometimes the setter for PropertyB is called before the
setter for PropertyA and the code falls over.

Is there a way, at designtime, to get round this? E.g. force one
property to be set from the designer before another etc?

Cheers

Andy
 
J

John Saunders [MVP]

Hi

I've developed an ASP.NET server control with 2 properties, PropertyA
and PropertyB. The setter for PropertyB uses the value of PropertyA to
perform some checking when set at designtime.

When the aspx page is opened in the designer, the properties are read
in from the aspx markup but the order the properties are set can't be
guarenteed. Sometimes the setter for PropertyB is called before the
setter for PropertyA and the code falls over.

Is there a way, at designtime, to get round this? E.g. force one
property to be set from the designer before another etc?

I don't think there's a way to do this, and it would not be a good idea.
What would happen if the designer weren't used? What if the properties were
set in markup?

The order of setting properties should not matter. If you need property A in
property B, you should first check to see if it has been set.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top