views:

134

answers:

1

Hi.

I have a stylistic question, really.

I am wondering which is the best, fastest, most "iterative" way to generate client HTML?

The road I am currently traveling is to use WCF (or a DLL) to expose a method that can be called depending on the page being loaded:

private AuthClient auth = null;

PageLoad {

auth = new AuthClient();

string pageHTML = auth.GetHTML(string param);

ClientElem.InnerHtml = pageHTML;

}

This seems logical to me but, maybe there is a more productive approach that I am not currently aware of? Also, if anybody has good examples of WCF methods that pump large HTML strings for rendering on the client, I would appreciate it (assuming that this is a reasonable approach).

Thanks.

+1  A: 

This would not be the most efficient approach because you are going to have to go through proxy creation, creation of a soap envelope to send the message to the service, then the delay response from the WCF service to create the string etc. What is it that you are trying to accomplish?

Michael Mann
+1 good points; basically, the UI should be contained and rendered on the client, while a WCF service should supply the actual data to be displayed, IMO
marc_s
OK, thanks. My problem I have with the data-only approach is - what happens when the page (as a whole) needs to be changed? I am trying to build a design that is super flexible and malleable. By having a WCF method that is responsible for HTML generation, all I need to do is update the service and never touch the client code (or codebehind). The particular page I am designing does not need any data, really. It is an input form such as a registration form. With flexibility / future HTML changes in mind, what would be your suggestions? Thanks.
Code Sherpa
One approach I like to take if you are using ASP.NET is the MVP (Model View Presenter) pattern. This view pattern works great for ASP.NET web forms and has served me well. You can see an example of the Supervising Controller pattern here http://www.jeremydmiller.com/ppatterns/SupervisingController.ashx
Michael Mann