I have a widget that contains about 40 controls in it. Essentially when a user makes a selection from a Dropdownlist on my main user control, what I want to do is call a webservice to get the new values for the controls in my widget. Is it efficient to have each control essentially call the webservice to get values that pertain to it’s new state Or is there a way to have the widget as a whole get the new values in a collection and then set each individual control within itself with the new values that apply, without really getting into a situation where you have too much going on and therefore loosing performance values
A:
Hello,
I understand your pain there. The latter option I think would be more efficient, but you have to provide a way to let each control pull out the relevant information that it would need. So you download the information once, then each of the 40 controls goes through a process of extracting the information only it needs.
If this is done on the client-side, it doesn't matter as much since you are passing the work off to the client, but still the latter option would be more performant IMHO. The question is how to get it to work efficiently and be easy to maintain. That's always the challenge.
HTH
Brian
2009-12-15 00:03:34
If the latter part is better, how do I better mark the data returned so the controls can easily identify which information belongs to which control? If you had this sort of situation to deal with, how would you? I want to get away from hardcoding this for each composite control in my application
Kobojunkie
2009-12-15 02:16:00
Yes, it's not an easy solution, especially if you are talking client-side. If you retrieve data in bulk, and you have this data as JSON, if each of these controls have a client-side component (MS AJAX approach or other), then you could have these components implement an interface, and check if that component meets it. You could implement a client-side observation approach, which is what I would recommend; register client control references to a specific need, and it can load that way. If you could give me some details, I could help better...
Brian
2009-12-17 21:21:33