Tales from the Evil Empire

Bertrand Le Roy's blog

News


Bertrand Le Roy

BoudinFatal's Gamercard

Tales from the Evil Empire - Blogged

Blogs I read

My other stuff

Archives

ASP.NET AJAX 4.0 CodePlex Preview 1 available

I'm very happy to announce that the first preview for the new Ajax features in ASP.NET just went live. Thanks to everyone who made that happen and thanks to all of you for providing feedback on the Roadmap.

This preview contains preview implementations for the following features:

  • Client-side template rendering
  • Declarative instantiation of behaviors and controls
  • DataView control
  • Markup extensions
  • Bindings

I'll go over those features in more details and provide walkthroughs in the following weeks.

As usual, all feedback is very welcome.

http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=15511

Comments

Aykut Ucar said:

Any plans of sample website?

# July 21, 2008 4:00 PM

Bertrand Le Roy said:

Eventually, yes, but we wanted to get the bits into your hands as early as possible.

# July 21, 2008 4:04 PM

NirvanaViper said:

Microsoft ASP.NET Ajax is Spam.

jQuery is Good.

# July 21, 2008 9:23 PM

Gratis Daghoroscoop said:

Can't wait to start playing with this!!

# July 22, 2008 3:18 AM

Mike said:

Finally! It was sooo obvious that most resources went to Silverlight for the last 1-2 years. And because I as an ASP.NET developer want to develop web sites, not Silverlight apps, I was getting really !*%$# about the lack of progress on ASP.NET Ajax.

Let's see some more controls!

# July 22, 2008 4:14 AM

Steve said:

I tried using asp.net ajax the other day for a simple call back to a web service and update content panel. I'm a pretty good javascript developer and have been using jQuery for a long time, but just thought I'd try the .Net way and see how easy it is.

I found a pretty good tutorial, but even at the end of it I had no real idea of how all the "magic" happens. .Net automatically inserted a load of rubbish into the page for me to make it all work.

I think the page was over 100k when it was downloaded and working. I did the same with one line of jQuery and the page was 47k altogether.

The only use I can see for this is for people who are clueless about javascript programming and have to use VB or C#. If that's the case, then they probably shouldn't be doinc client-side programming anyhow IMO!

# July 22, 2008 4:44 AM

Howard said:

What was the point of your comment, NirvanaViper? How on earth is MS Ajax "Spam?" It's a technology which incidentally Micrsoft pretty much pioneered, and everyone else has adopted. I don't know JQuery from a hole in the ground, but then I'm happy with my Ajax solution (which isn't MS Ajax)

Spam is tedious, irrelevant junk - pretty much like you posting. If you don't like it, go elsewhere.

# July 22, 2008 5:32 AM

Mikael Söderström said:

Will it be compatible with ASP.NET MVC?

# July 22, 2008 8:37 AM

Brian Sherwood said:

NirvanaViper, your comment is spurious and irrational. This post/article is nothing to do with jQuery.  Spam is unwanted email, which doesn't fit ASP.NET at all.  ASP.NET remains a powerful development paradigm and language used by businesses world-wide. I have supported my family for years wiht my ASP.NET development services.

The fact that you won't even use your name speaks volumes.

# July 22, 2008 9:04 AM

Brent said:

@NirvanaViper - Apparently you have no clue what spam is. For a good example, see your last comment...LMAO.

# July 22, 2008 9:34 AM

Andrey said:

I've tried DataView control, but it doesn't work.

I get error about Sys.UI.Preview.DataView is null. Do I do something wrong?

# July 22, 2008 10:56 AM

Mel Pama said:

I'm not a user of Ajax at this time, however it is seeming to me that it is becoming a replacement of ASP.NET when almost everything is using Ajax, whether it warrants it or not.  Eventually there will be no difference because it will take just as long to wait for all the Ajax updates as it was taking to update just the whole page at the same time with ASP.NET.  A litle Ajax is a good thing, there more is better???? I beg to differ.

Mel

# July 22, 2008 11:07 AM

Stuart Campbell said:

Looks promising!

@NirvanaViper: I use both ASP.NET Ajax and jQuery and they are both good. Not sure how you can class a script library as spam...but anyway.

# July 22, 2008 11:52 AM

Bertrand Le Roy said:

@Mikael: what we put in the preview is pure client-side script, so it should work just fine with MVC. Actually, the latest MVC preview has JsonResult, which should be a very good fit with the template engine.

@Daniel: this is a very early preview, and we don't have much documentation ready. Feel free to ping me for questions. The dataview control has an event that gets fired every time a template is instantiated (itemCreated), and the arguments give you access to the dataItem that's being rendered and the templateResult, which enables you to manipulate the generated DOM. Is that what you were asking for?

@Andrey: did you include the script file to the page? Did you also iclude the Ajax Library?

# July 22, 2008 2:12 PM

Jason Diamond said:

@Andrey: There's a typo in the ReadMe.txt file. The actual class name is Sys.Preview.UI.DataView.

# July 22, 2008 2:46 PM

Bertrand Le Roy said:

@Jason: good catch, thanks. I'm updating the readme.

# July 22, 2008 5:15 PM

Andrey said:

@Jason: Thanks! The error is not occurs again.

But I get only {{name}} and {{description}} titles on the page, not data from someArray.

# July 22, 2008 9:44 PM

Bertrand Le Roy said:

@Andrey: you can send me your code at bleroy at microsoft, and I'll have a look.

# July 23, 2008 12:00 AM

gt1329a said:

@Andrey: This example may help you get started with the DataView:  encosia.com/.../sneak-peak-aspnet-ajax-4-client-side-templating

There are also a couple suggestions based on my initial impressions, Bertrand.

Thanks for giving us all early access to this stuff.  It looks very promising, so far.

# July 23, 2008 9:31 AM

jgd12345 said:

Hi, good to see you're acting fast on this.  I'd like to see the client server controls.  The doc says this will be in a futures release but surely these should be quite trivual to build once the client library is built.  If this is being pushed back because it wouldn't be useful for mvc then i don't think that is fair on the majority of your user base who are using web forms.

Also i'm interested to see how the client data source controls could allow me to do paging, sorting without page refreshing.  Currently i've been using UpdatePanels (wrapped around a ListView) as alot of the alternative approaches require too much work.  However UpdatePanels don't perform too well when there is lots of data.

# July 23, 2008 10:31 AM

Bertrand Le Roy said:

@jgd12345: nothing is trivial :) and this is not being pushed back, especially not because of MVC (this stuff actually works great with MVC). The data source should be in the next release.

# July 23, 2008 2:55 PM

Drew Marsh said:

Bertand,

I love the new release, but I have one bit of commentary on the client templates so far. Right now you guys have invented a special syntax that overloads the standard comment syntax with an additional asterisk to denote that it actually is code. Instead of doing this, why not use processing instructions? It's exactly what they were intended for. For example:

<?aspnet-script

if(item.property == "Something")

{

?>

<span>Something!</span>

<?aspnet-script

}

else

{

?>

<span>Nothing :(</span>

<?aspnet-script

}

?>

This should also make the parsing experience simpler (for runtime and design time) because you can more easily detect the presence of these PIs rather than having to inspect each comment tag.

Of course the PI target name is up for debate... "aspnet-script" was just a first stab at it. :)

Cheers,

Drew

# July 23, 2008 9:08 PM

Bertrand Le Roy said:

@Drew: You currently don't get IntelliSense at all in the blocks, which is way better than completely wrong and obtrusive IntelliSense, which you'd get with processing instructions.

I don't think a custom tag would work either because they would need to be allowed anywhere in the XHTML markup, which if I'm not mistaken they're not.

We also considered something along the lines of < sc ript type="application/microsoft-javascript"> but that is way too long to type and remember.

We're not super-happy about using comments but it's our best option apparently.

# July 24, 2008 4:32 PM

phanatic said:

I wrote a post about how to do Master-Datails view with the DataView. I thought I'd put in a manual trackback.

-Phani

# July 25, 2008 12:00 AM

JRumerman said:

Hi Bertrand,

I'm finally taking some time to dig into the new preview and came up with an initial question.

With declarative instantiation of controls and behaviors, how do I guarantee that the JS file that contains the client component will be available on the page? Do I assume that the declarative instantiation is used at the page level and that the script file containing my client component will be included as a ScriptReference? If I were rendering a control using Rendercontents and wanted to include a declarative instantiation approach with my component (not sure why I would want to, though), would I still need to implement IScriptControl and provide the ScriptReference in the GetScriptReferences method? Is the usage pattern for the declarative instantiation focused at the Page level vs. the Control level?

Also, on a different note, I'm getting a bit confused with the different previews. Why wasn't the ScriptReferenceProfiler included in this preview? I've got two separate previews going on to get me the latest and greatest...

# July 26, 2008 9:18 PM

Bertrand Le Roy said:

@JRumerman: The js files have to be included into the page somehow, either as a script reference or a plain script tag. If you want to create a server-side extender for your behaviors, nothing has changed here. You do it the same way as you did before. This release really is pure client-side additions that do not modify the server-side model at all.

The ScriptReferenceProfiler isn't exactly preview. It's an optional tool that will probably remain a separate download for the foreseeable future.

# July 27, 2008 1:03 AM

Aurelien said:

Me again !!

Actually, for the "Code Blocks" issue, I found why it doesn't work.

It's the difference between NULL property value and a property typo issue.

Maybe including a try/catch block in the anonymous template code function could be a nice way to handle that kind of typo issues.

# July 29, 2008 8:21 AM