5.20.2008

Reusable Themes with CompiledThemeBuildProvider

I've created a BuildProvider that allows ASP.NET developer to create reusable themes. The theme and its content are compiled into a library, and the build provider extracts the selected themes and copies them into the web project at compile time.

Check it out on CodePlex!

Labels: , , , , , , ,


2.07.2007

ASP.NET side basically done

I'm basically got everything on the ASP.NET backend working. ObjectFactory now returns a single object of a new class called "ObjectFactoryResponse", which includes a collection of both regular ObjectFactory objects and a collection of another new class, WebServiceControlData. WebServiceControlData contains the item's Id, the rendered HTML and a collection of ScriptDescriptors (used for sending values to AJAX Sys.UI.Controls).

It was kind of tricky getting it to render the HTML without being on a real page - I forgot/didn't realize/should've known/etc that HtmlTextWriter needs have Flush() called before it actually writes anything to the stream. I'm guessing that method is normally automatically called by the Page object. It took me a bit of playing around to figure that one out.

The really nice part is that the overall amount of work that was required to get to this point was considerably less than I thought it would be. Now I have to wire up everything on the client side, which I think will actually be quite a bit more effort, since I'm not nearly as familiar with AJAX.

Labels: , , , , , ,


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: , , , , , , ,


2.01.2007

...OfTheDay

I'll be using this pre-dated entry to explain about my new personal ASP.NET project, called ...OfTheDay. It will be written in ASP.NET using C#, use SQL Server 2005 as its backend, and will be highly customized using Microsoft's ASP.NET AJAX.

I'm am hoping for ...OfTheDay to become one of those useless sites that people with nothing better to do will sit and gaze at for hours. The idea is that users will submit a finite number of categories of "things" to vote on each day. Within each Category, users will submit a finite number of nominees for things that fall in to each Category. So for example, if a user created the Category "Fish", another user might nominate "Trout", while another might nominate "Salmon". Other users would vote on which Nominee should be the "Fish of the Day". The category with the most cumulative votes will be the "Thing of the Day". See? Completely useless, but I think it could be fairly addictive, especially if I added in incentives to vote and have your categories or nominees win. For example, the more you participate, the more your votes are worth, or something similar.

I will be taking advantage of AJAX's asynchronous communication to keep all the objects on the page constantly updated. In order to cut down on bandwidth consumption, all the controls will be rendered using AJAX's client script, which will allow me to update only the individual controls that have actually changed, instead of wasting bandwidth updating everything, as would be necessary with traditional ASP.NET WebForms, even if AJAX UpdatePanels are involved.

I will also be using a C# library called "ObjectFactory", which I can't talk too much about because it was written by a colleague of mine, Portman Wills. Basically, a single ObjectFactory object represents a record from a table in the database. On his recommendation, I have modified his version considerably so that the factories themselves can be used as WebServices, and also work directly with the "WebServiceControls" I will be creating later on.

Labels: , , , ,


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

Subscribe to Posts [Atom]