ASP.NET AJAX Team Blogs

Browse by Tags

All Tags » HTML (RSS)
JavaScript class browser: once again with jQuery
I’ve already posted twice about that little class browser application. The first iteration was mostly declarative and can be found here: http://weblogs.asp.net/bleroy/archive/2009/09/14/building-a-class-browser-with-microsoft-ajax-4-0-preview-5.aspx The second one was entirely imperative and can be found here: http://weblogs.asp.net/bleroy/archive/2009/10/15/entirely-unobtrusive-and-imperative-templates-with-microsoft-ajax-4-preview-6.aspx This new version builds on top of the code for the imperative version and adds the jQuery dependency in an attempt to make the code leaner and simpler. I invite you to refer to the imperative code (included in the archive for this post ) and compare it with the jQuery version, which shows a couple of ways...
How to render the same template on the server and client with minimal redundancy
Last week, I wrote a post about how the new Microsoft Ajax Library Preview 6 made it a lot easier to write unobtrusive and imperative data-driven applications . Because for the previous preview, I had written a cool little class browser using a declarative style, I thought it would be nice to rewrite this in a completely imperative way. The mistake I made though was to call it unobtrusive. Never mind that ‘unobtrusive’ is a perfectly well-defined word that actually existed way before JavaScript. ‘Unobtrusive JavaScript’ has a very specific meaning that people feel strongly about. To be worthy of that label, an application must basically conform to (at least) those two requirements: Markup and behavior are strictly separated. That means no DOM...
Entirely unobtrusive and imperative templates with Microsoft Ajax Library Preview 6
Today is the release of the sixth preview of Microsoft Ajax Library. Don’t get fooled by the somewhat silly and long name: this is a major release in many ways. The scripts have been majorly refactored since preview 5. Check out the other posts out there (links at the bottom of this post) to see just some of the many new features that are in there. Some of my favorite are all the small improvements that have been made to make imperative instantiation of components and templated contents easier than ever. Many of you have told us that you preferred to do things imperatively and this release makes it a lot better. When Preview 5 came out, I built a simple class browser using the declarative syntax. The class browser shows the hierarchy of namespaces...
Building a class browser with Microsoft Ajax 4.0 Preview 5
The Microsoft Ajax Library 4.0 Preview 5 is the first release of Microsoft Ajax that I didn’t participate in: I left the team a few months ago. But that doesn’t mean I don’t love what’s in there, and I really do. And by the way I’ve also seen what’s in Preview 6 too and man that will seriously rock. So I thought I’d write a little something to celebrate the new preview. The new features include recursive templates, which is pretty much begging us to implement a treeview with it, and we’ll do just that in this post. There is also an intriguing capability, which enables you to dynamically set what template to render for each data item, and where to render it. At first, this doesn’t look like the most useful thing in the world, but it actually...
Why is ASP.NET encoding &’s in script URLs? A tale of looking at entirely the wrong place for a cause to a non-existing bug.
Several people have reported seeing errors in their logs that seem to be due to requests such as this: /ScriptResource.axd?d= [lots of junk] & t=ffffffffee24147c The important part here is the HTML-encoded “&” sequence, which stands for “&” of course. If this exact URL is sent to the server, the server won’t know what to do with the escape sequence (URLs are not supposed to be HTML-encoded on the wire) so the parameters won’t get separated as expected, potentially resulting in a server error. This bug in the toolkit is an example of that: http://ajaxcontroltoolkit.codeplex.com/WorkItem/View.aspx?WorkItemId=13134 Of course, when people see 500 errors popping up in their server logs, they immediately assume the application...
New release of the Ajax Control Toolkit
A new version of the AJAX Control Toolkit is now available for download from the CodePlex website. It contains three new controls: HTMLEditor - allows you to easily create and edit HTML content. You can edit in WYSIWYG mode or in HTML source mode. The control exists as a server-side extender but can also be instantiated purely on the client-side with a single line of code. Many thanks to Obout for building this. ComboBox - provides a DropDownList of items, combined with TextBox. Different modes determine the interplay between the text entry and the list of items. this control behaves very much like a Windows combo. Many thanks to Dan Ludwig for building this. ColorPicker - can be attached to any ASP.NET TextBox control to provide client-side...
Microsoft Ajax 4.0 Preview 4 now available
The Microsoft Ajax team made the fourth preview of the 4.0 version available on CodePlex . This is an important release because it enables the full client data story, complete with the ability to get changes back to the server automatically. Here’s a quick recap of some of the available features: Getting a client representation of data from an ADO.NET and REST data service. Rendering data on the client using templates . Declarative instantiation of client components. Live bindings , enabling changes in the UI and in the data to be automatically propagated. Command bubbling for codeless wiring of events in template-driven controls. Data identity and association management for efficient and consistent client-server data exchanges. Sending changes...
How to choose a client template engine
Disclaimer: I worked on the Microsoft Ajax 4.0 template engine, so my criteria are of course heavily influenced by our own design. Templates are a data rendering method that server-side developers have enjoyed since the old days of classic ASP and PHP. The idea was quite simple (add code blocks and dynamic expressions directly into HTML markup) but it revolutionized web development, which before that relied on the opposite method (spitting HTML from CGI code). On the client-side, the browser provides two ways to generate HTML: innerHTML and the DOM API. Template rendering is of course possible, but only using a JavaScript library. To be honest, one should mention XSLT here, which is standard and widely supported but whose somewhat unusual syntax...
Alternating styles in DataView
A few months ago, I showed how you can alternate styles using CSS in a server-side ListView , by selecting the class depending on the remainder of the division of the data index by two. Well, you can do the exact same thing with the client-side DataView. Let’s first define the classes we’ll want to apply to the even and odd rows: tbody tr { background-color : #f0f0f0 ; } tbody tr.odd { background-color : #c0c0c0 ; } Then, we can use the class namespace to bind the presence of a CSS class to a Boolean condition: < tr class : odd ="{{ $index % 2 }}"> Within the context of the template, $index is the index of the current data item, so $index % 2 will be evaluated as 1 and 0 alternatively. For JavaScript, when evaluated in a Boolean...
JavaScript Behavior Sheets: an experiment
Here’s a little experiment. I’m really after feedback on this one as I’m trying to decide whether this is a good idea. It’s also entirely possible somebody else did this before. That would be good feedback too. Anyway, here it is. Despite its shortcomings, CSS has a number of features that make it very compelling. First, it decouples styling from markup. Second, its selector syntax is simple, yet reasonably powerful. So we have semantic markup on the one hand, and styles on the other hand, and the only coupling between the two is the selectors in the stylesheet. In Ajax applications, there is a third kind of entity in the mix, JavaScript behavior. There are of course ways to decouple the script behavior from the markup, which are usually referred...
More Posts Next page »