2.06.2007
ASP.NET for JavaScript rendered controls
So, I started creating the site by creating controls entirely using the javascript DOM, and I've decided that doing it that way is a complete pain in the ass, so I'm going to be trying something new.
The end result I want is to have a way of creating controls whose entire lifetime on the page itself is initiated and controlled by client script, and then have the controls’ properties updated without actually recreating the controls themselves. However, because of how tedious it is to design web pages and controls entirely using the DOM in javascript, I thought it would be really cool if I could use ASP.NET to generate the actual controls for me, and then have them returned via a web service. I can use AJAX’s IScriptControl to automatically create bindings between whatever server side control or object I create and the client side javascript class.
Some things I was thinking about:
-Creating a new control type (like .wscx for WebServiceControlXmakesitsoundcool) and IHttpHandler made specifically with the intent of being rendered into an XML stream for use with a WebService
- Would be designed like ASCX controls, with HTML and a codebehind. Maybe just inherit from UserControl? Problem with that is that it won’t be contained in a Page class.
- Factory objects would take an additional generic Type parameter, TWebServiceControl, and which would allow this functionality to actually become part of the DAL
-Web service list methods would take a list of existing objects as parameters. List response would contain two parts: XML with HTML content (the WebServiceControl) for new objects (ie, objects that are missing from the list of existing objects), and regular data types (contained in serialized ObjectFactory objects) for updates to existing objects.
The end result I want is to have a way of creating controls whose entire lifetime on the page itself is initiated and controlled by client script, and then have the controls’ properties updated without actually recreating the controls themselves. However, because of how tedious it is to design web pages and controls entirely using the DOM in javascript, I thought it would be really cool if I could use ASP.NET to generate the actual controls for me, and then have them returned via a web service. I can use AJAX’s IScriptControl to automatically create bindings between whatever server side control or object I create and the client side javascript class.
Some things I was thinking about:
-Creating a new control type (like .wscx for WebServiceControlXmakesitsoundcool) and IHttpHandler made specifically with the intent of being rendered into an XML stream for use with a WebService
- Would be designed like ASCX controls, with HTML and a codebehind. Maybe just inherit from UserControl? Problem with that is that it won’t be contained in a Page class.
- Factory objects would take an additional generic Type parameter, TWebServiceControl, and which would allow this functionality to actually become part of the DAL
-Web service list methods would take a list of existing objects as parameters. List response would contain two parts: XML with HTML content (the WebServiceControl) for new objects (ie, objects that are missing from the list of existing objects), and regular data types (contained in serialized ObjectFactory objects) for updates to existing objects.
Labels: AJAX, ASP.NET, asynchronous, C#, DOM, IHttpHandler, IScriptControl, JavaScript
Subscribe to Posts [Atom]