A couple weeks ago, I was checking out Google Finance and noticed something scary. One of two things had just occurred; either the whole world just went broke or (slightly more likely) the web service call to retrieve the data had failed or timeout.
While the scenario was quickly fixed by refreshing the page, these are the usability points that are commonly overlooked when designing for UX. What should happen in case of failure? In this case, the default value that’s used is a 0 (zero). When dealing with numeric values, I prefer to show “N/A” or “NaN” if the audience is mathematically inclined.
Working on top of what I learned from this article, I decided to leverage the rich capabilities of .NET’s Web UI components as part of my ajax implementation using HTML injection. I used jquery to bind a standard button to make a call to my Web Service method.
The service created and populated a standard GridView object. The service would then render that object and return the HTML that was generated. This HTML, once returned by the service call, would be injected into a DIV tag that served as the container for the results table.
My initial implementation is a naive solution that renders full HTML on the server side and passes that back to the client-side. My ASP.NET page already has a script manager so I added a reference to my web service (simple .asmx in this scenario).
My service defines a method Foo:
/// Summary description for ConceptServices
[WebService(Namespace = “http://tempuri.org/”)]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1, Name = “MyBinding”)]
public class ConceptServices : System.Web.Services.WebService
public String Foo()
return “Hello World!”;