Hello all. I'm trying to transition to using AjaxPro and am struggling with the best pattern to use to process form data asynchronously. I saw the example that simply loops through the form and builds a data array that gets converted to a JavaScriptObject on the server, so I'm trying that. What I was hoping is that by naming the UI fields the same as the entity object properties on the server, I would be able to directly deserialze the data object into my entity. For example, on the server I'm doing this:
ContactEntity contact = (ContactEntity)AjaxPro.JavaScriptDeserializer.Deserialize(o, typeof(ContactEntity)); I was hoping that it would return my object populated with as many properties as it found matches for, ignoring anything that did not match, but this does not work. I saw the Yahoo web service example, and in that case JSON is being directly converted to a "business" object -- I'd like to use this same pattern with my entity objects. Is there an easy (non-manual) way to serialize the form directly to JSON instead of to a JavaScriptArray? It seems like that would be the preferred approach, but I haven't seen any examples of that. It seems like the ideal pattern would be: - Name all fields to correspond with entity object fields where possible - Serialize form to JSON on submit - Deserialize directly to the business entity on the server, similar to the Yahoo example - Manually populate any additional data that could not be deserialized (if needed) - Process the business entity and return a result I can map all of these fields manually on both sides, but surely there is a better way? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ajax.NET Professional" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/ajaxpro The latest downloads of Ajax.NET Professional can be found at http://www.ajaxpro.info/ Don't forget to read my blog at http://weblogs.asp.net/mschwarz/ -~----------~----~----~----~------~----~------~--~---
