10-4 Episode 8: Pure Client-Side Development with ASP.NET AJAX 4.0

Sign in to queue

Description

In this episode of 10-4, we introduce some of the new features and functionality of ASP.NET AJAX 4.0. We’ll see how ASP.NET AJAX can be leveraged in a complete client-side environment, making it easier to develop rich web applications. This episode demonstrates the new client templates, data binding and command bubbling behavior that makes creating data-centric applications using JavaScript simpler. We’ll also see the new ADO.NET Data Services integration which makes performing CRUD operations, complete with change-tracking, very trivial.

For more 10-4 episodes, be sure to visit:
https://channel9.msdn.com/shows/10-4

Visual Studio Topic Area on Channel 9:
https://channel9.msdn.com/VisualStudio

Visual Studio 2010 CTP VPC:
http://tinyurl.com/GetCTP

ASP.NET AJAX 4.0:
http://www.codeplex.com/aspnet/Wiki/View.aspx?title=AJAX&referringTitle=Home

10-4! Over and out!

Embed

Download

Download this episode

The Discussion

  • User profile image
    LostIn​Tangent
    To clarify one thing about the demo I showed off in the video...the DataView control, bindings, command bubbling, and ADO.NET Data Services integration are currently available on Codeplex, but the change tracking functionality and the ability to save changes back to the service aren't. That behavior will be included in the next Codeplex preview, along with much more.
  • User profile image
    buckley9
    I realy enjoyed this video. Thanks for teaching us this stuff Jonathan.

    The new stuff that's comming looks great (2 way data binding and unit of work!) and was presented very well. The form of the presentation was also good so nothing but kudos Smiley

  • User profile image
    joechung
    My biggest problem with ASP.NET Ajax client templates:  it fails to render anything when script is disabled.  I don't expect the templating to work at all when that happens, obviously, but it should have an acceptable fallback strategy, and it doesn't.  Google "unobtrusive JavaScript."  Hint: use NOSCRIPT to render the data.
  • User profile image
    Chris​Stepaniuk

    Awesome technology, quite different to what were normally seeing with Server Controls and having ASP.NET generate the correct runtime scripts to wireup the controls for us.  As an honest comment, it seems the more fluid site like Facebook get, the more ASP.NET AJAX is trying to catch up so developers choose that technology.  It's a good thing.  I can remember a time when ASP.NET was considered what you used to build business apps, but if you wanted to build "fun" sites, you would create that in PHP because it was percieved as "less-heavy".

    Also, it seems that there is plenty of "magic" going on too, if someone wanted to override a part of the pipeline, say if they use controls from vendors like Telerik?

  • User profile image
    stevo_

    Whilst interesting I'm not sure who this is targeting.. is this for purists who want control over html? because they won't use this due to how obtrusive it is.. I think this targets the webforms developers, those that don't really care about whats under the hood, or even how the web works as such, only that they can create an app online.. but then I'm wondering if this is better to them than webforms?

  • User profile image
    LostIn​Tangent

    That's a good question. Firstly, it's important to point out that almost that entire demo could have been done imperatively, without adding anything to the HTML unneccesarily. The declarative command bubbling (sys:command) is a feature I can choose to use, but I can achieve the exact same thing strictly in JavaScript. The same goes for the conditional attributes I used (class:odd).

    While ASP.NET AJAX provides a lot of functionality in terms of working with it declaratively (as some folks like), it was developed with the mindset of using it completely unobtrusively. That said, the data templates are somewhat of a gray area. Defining the template is arguably much easier (for some) to do in HTML as opposed to within JavaScript (as other libraries do). That said, it does impose a foreign component to the HTML that isn't actually valid content (i.e. the binding expressions).

    If you don't like the approach of defining your templates and bindings within the markup, you can still do that in JavaScript as well. The creation of the DataView class simply requires an element that it can bind to and repeat, so there is no reason why that element couldn't be constructed using DOM methods imperatively, as opposed to retreiving it from the actual DOM as I did in the demo.

    I'll put together a demo that does this and post it later.

  • User profile image
    aL_
    thats pretty cool Smiley
    i especially like the binding syntax Smiley
  • User profile image
    Reader Man1
    We are very interested in seeing an episode about having the VS IDE made from WPF.
    so please can we know when u are thinking to make one.
  • User profile image
    Felixters
    Another great video.  However, I'm a skeptic with this video.  If I understand it right, the data is being rendered through javascript after the page loads using a web service.  I'm not sure I see the advantage of using this approach as opposed to a server side approach considering that google won't be able to index any data that is retrieved using the client side method.  Am I missing something?

    Also, the example shown in the video is one where the presentation layer and the data layer are tighly coupled.  I'm not very familiar with the EF or web services, but is it possible to have the interface bind to a custom business layer instead of the data layer?

    Keep up the great work with the videos.
  • User profile image
    spikeyz

    Hy,

    I don't see the real interest of this new programing method.
    What is the interest to use Microsoft technology without a IIS server ?
    Full Microsoft or not ?

    I think it's just attracting php or others langages developers.

  • User profile image
    Zirc75

    Jonathan, now that Beta 1 is off do I still need to include Ajax 4.0 JS libraries or are they included in the framework?

    The reason of the question is because I tried to reproduce your sample (without addind ajax libraries) and 

    sys.application is not recognized as valid ("Sys is not defined").

     

    Thank you

     

    Carlo

  • User profile image
    mensaco

    Great video. I tried to reconstruct it on my computer, but somehow can't figure out, where do I actually find the  AjaxRes.js file. I assume that might be the reason for the "Sys.InvalidOperationException: 'query' is not a property or an existing field." error message that I keep getting.

    I'd appreciate a small hint. Smiley

  • User profile image
    jwize
    /// 
    /// 
    /// 
    
    Sys.Application.add_init(function()
    {
        $create(Sys.UI.DataGrid,
        {
            alternateRowClass: "odd",
            columnExpressions: ["Title", "FirstName", "MiddleName", "LastName", "Suffix"],
            dataProvider: $create(Sys.Data.AdoNetDataContext, { serviceUri: "AdventureWorks.svc" }),
            itemPlaceholder: $get("customer-placeholder"),
            fetchOperation: "Customers",
            fetchParameters: { $top: 20, $orderby: "FirstName" }
        },
        null,
        null,
        $get("customer-list"));
        
    });
    

    I am not sure if this say anything but it might indicate that the dataview has been changed a little. Try typing this into the javascript editor to gain some insight. I got this from the samples download on msdn. http://msdn.microsoft.com/en-us/library/bb514232(VS.100).aspx">http://msdn.microsoft.com/en-us/library/bb514232(VS.100).aspx

    var dv = new Sys.UI.DataView();

    when you type dv. the intellisense should give you some more information.

     fetchOperation: "Customers",
     fetchParameters: { $top: 20, $orderby: "FirstName" }

    ... would be my first guess.

  • User profile image
    LostIn​Tangent

    AjaxRes.js is actually an artifact of the internal builds that I was using for the video Smiley If you grab the latest bits off of Codeplex, you won't need it.

  • User profile image
    LostIn​Tangent

    Yep, you'll need to include the JavaScript files. Just keep in mind that the ScriptManager control in ASP.NET WebForms was the one that was including the ASP.NET AJAX libraries for you, so once you aren't using it, you'll have to include the scripts manually.

  • User profile image
    LostIn​Tangent

    Yep, exactly. Unfortunately, because we're trying to be cutting edge with this show, stuff WILL change between an episode being published and new versions of the bits coming out Smiley

  • User profile image
    Lek

    Hi, thank you for a great video.

    I have a little question : is it possible (and if yes, is it easy ?) to mix this kind of client side technologie with standard asp.net webcontrols (ie. with postback/viewstate/etc..) ?

     

    Best regards,

     Lek

     

Add Your 2 Cents