2.07.2007

ASP.NET for JavaScript rendered controls, continued

I started playing around with it last night, and already have discovered that some of my assumptions will need to be changed.


First, I can't use IScriptControl. IScriptControl depends on having access to a ScriptManager. More specifically, THE ScriptManager that will be on the actual page. So while I could just add ScriptManagers into the controls I create, it would be pointless since it would actually be able to do anything. I will still be using one method from IScriptManager though - IEnumerable GetScriptDescriptors(), but I'll have to do some research into the AJAX Sys.Component or Sys.UI.Control constructors to figure out how I can pass that info into my javascript controls.


Also, I'm 90% sure that creating my own control type is a bit unrealistic. Its completely possible - with the Visual Studio 2005 SDK, I can even create my own custom directive (like <%@ WebServiceControl ... %>), but it seems more realistic to just inherit from UserControl. The question here is whether TemplateControl.LoadControl(...) (TemplateControl is the abstract class Page and UserControl both inherit from, LoadControl allows you to get an instance of a Page or UserControl from a virtual path) will work from the WebService if I just instantiate a new object.

Labels: , , , , , , , , , ,


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.

Labels: , , , , , , ,


This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]