Calling WebService for widgets or composite controls
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 开发者_JAVA技巧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
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
精彩评论