October 2008 - Posts
In my talk, I was talking a little about the process of sending data from the server to client. In pretty much most data storage mechanisms or transports, the process of transporting data requires a serialization and deserialization process. For instance, if you push data to the database, you pull out the primitive data of some data object (whether be a DataRow, LINQ object, custom POCO object, or something else). You generally don't store the whole reference to the object and set the reference to the client. It has to be serialized.
What I actually found is that objects can be automatically serialized using the descriptor.AddProperty method. So when describing teh component, adding an object to the descriptor through AddProperty will automatically deserialize it correctly. Collections do not: this process is done via a JavaScriptConverter. An example of this is: http://msdn.microsoft.com/en-us/library/system.web.script.serialization.javascriptconverter.aspx.
In this example, the converter serializes and deserializes the content using a dictionary of type Dictionary<string, object>. On the client, and object in the collection looks something like the following format: {"Text" : "2", "Value" : "2" }. A list as a string gets passed to the client that represents the whole collection. So in a nutshell, that is the serialization process. To deserialize it on the client, use the Sys.Serialization.JavaScriptSerializer.deserialize() method.
I wanted to say thanks to all who attended my presentation. I hope you found it worthwhile. I will publish the link where all of the code will be put at so the general public can access it. If you are interested in looking at an AJAX control/extender presentation and sample code, you'll find that shortly. I would assume the link would also be available here: http://www.cmap-online.org/
On October 25th, I will be speaking at the Central Maryland .NET user group at their code camp. The code camp is hosted at Loyola College Graduate Center and is open to the public. More information about this is at the following link: http://www.cmap-online.org/CodeCamp/. I will be speaking on developing ASP.NET AJAX control/extender development, of which I'm trying to write a book on the subject. So come hear me talk about this highly useful and interesting topic if you are in the area.
I found something interesting when dynamically creating a button in JavaScript. If I coded the button like the following:
var button = document.createElement("INPUT");
button.type = "button";
parent.appendChild(button);
button.value = "Click Me";
This worked fine, but if I reversed it to this:
var button = document.createElement("INPUT");
parent.appendChild(button);
button.type = "button";
button.value = "Click Me";
This did work, an HTML file error. Interesting.
I tried to define the following:
Public Class EvaluationCriteria
Public DisplayText As String
Public IsMet As Boolean = False
Hoping that I could get away with this. Turns out, as these two values are referenced in binding via the Eval() method, these don't work correctly. So it turns out, fields dont' necessarily work correctly with Eval. Didn't know that until I was trying to shortcut 
As I mentioned before, AJAX supports calling web services from the client using an XmlHttpRequest object. But sometimes, things don't go as expected. If you make the call, an error may occur in the web service, which you'd get an error prompt. However, there's one other aspect to this.
Sometimes the web service works fine, but you get an error with the breakpoint in the executor of the web service (ASP.NET AJAX code). There isn't a callstack, which is really hard to debug. What I've been finding out is that an error in the success or failed callbacks (which every web service supports a success or failed callback method that returns the results) will also act as if the executor failed, but that isn't the case.