Blog - Microsoft .NET, ASP.NET, AJAX and more

Getting ActiveTabChanging Functionality from the AJAX TabControl

by Dave Marini 1/4/2010 8:08:00 PM

I have always considered myself to be quite client-side challenged. Having been soured to the thought of JavaScript by all the browser specific code I used to have to write years ago I swore off it and took to server-side development and never looked back. After a year’s hiatus doing WPF programming, I’ve recently found myself back in the thick of web development with new patterns and technologies at the forefront, namely the MVC framework and the ubiquity of jQuery. Before I begin this post I’d like to say that jQuery is, well, everything that is good about client-side programming in my opinion.

So recently I found the need to roll my own dirty form warning mechanism on a site I was working on. These forms contain quite a lot of fields and so there is gratuitous use of the TabControl from the Microsoft AJAX Control Toolkit. One of the requirements was to alert the user to changes made on one of the tabs and offer the option to save the changes before allowing the user to change tabs. Initially I thought that this task would be a breeze, what with the OnClientActiveTabChanged handler on the TabContainer control and all. Then the sad reality dawned on me. There is no way to cancel the changing of tabs from the client side. Like a freight train full of explosives it barrels on, destroying my workflow and with it any chance I’ll get sleep. But all is not lost, because with a few JavaScript ninja moves, some nifty jQuery (optional) and no personal life there is a clean solution to this problem, So what’s the answer? Read on for the details. More...

Shout it kick it on DotNetKicks.com Bookmark and Share

ASP.NET 4.0 AJAX Issues

by Damien White 8/27/2009 8:14:58 PM

PuzzledMan I’ve been using ASP.NET AJAX 4.0 quite a bit lately in ASP.NET 3.5 applications.  I encountered two issues tonight, and I hope this post saves someone some grief.

The first problem has to do with referencing the ASP.NET AJAX 4.0 library within an ASP.NET 3.5 application, and the second was a surprising data binding issue using the DataView

If you are looking for more information on ASP.NET AJAX 4.0, be sure check out my other articles on the site.

Issue 1 – The ScriptManagerProxy and CompositeScripts

The first issue I encountered was a client side error when using the DataView on a content page in my ASP.NET 3.5 SP1 application.  This site utilizes master pages, so I’m using a WebForm, otherwise I probably would have just gone with a plain old HTML page.  Regardless, since this is an ASP.NET application and the ScriptManager is declared in the Master page, I added the ASP.NET 4.0 AJAX scripts to a ScriptManagerProxy (instead of the ScriptManager itself). The code for the ScriptManagerProxy looks very similar to that for the ScriptManger.

More...

Shout it kick it on DotNetKicks.com Bookmark and Share
Tags:
Categories: AJAX | ASP.NET
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed

ASP.NET AJAX 4.0 and the ScriptManager Control

by Damien White 6/1/2009 7:15:48 PM

Puzzle Pieces I have been using ASP.NET AJAX 4.0 quite a bit lately, as I’m sure most of you are aware from my recent posts.  In those posts, I used standard HTML script references to show that ASP.NET AJAX is not reliant upon ASP.NET.  I realize that many of you are in fact using ASP.NET, and today we will take a look at using the ScriptManager. 

First we’ll look at using the Preview 4 scripts within an ASP.NET 3.5 application (with the ScriptManager of course) as well as using client templates and ADO.NET Data Services with the ScriptManager in ASP.NET 4.0 (Beta 1).  After that, we’ll take a closer look at some of the new features of the ScriptManager in ASP.NET 4.0. 

Preview 4 and the ASP.NET 3.5 ScriptManager

In my posts on ASP.NET AJAX 4.0 so far, I used standard HTML script references (as stated earlier).  However, what if you wanted to incorporate the new ASP.NET AJAX 4.0 scripts with a ScriptManager.  I tried this in a recent ASP.NET 3.5 SP1 project, and ran into some issues getting it all to work out.  Thanks to this blog (and Bertrand LeRoy), I found the solution.

<asp:scriptmanager id="sm" runat="server">
<scripts>
<asp:scriptreference scriptmode="Inherit" name="MicrosoftAjax.js" path="~/scripts/MicrosoftAjax.js" />
<asp:scriptreference scriptmode="Inherit" path="~/scripts/MicrosoftAjaxAdoNet.js" />
<asp:scriptreference scriptmode="Inherit" path="~/scripts/MicrosoftAjaxTemplates.js" />
</scripts>
</asp:scriptmanager>

More...

Shout it kick it on DotNetKicks.com Bookmark and Share

ASP.NET 4.0 AJAX – Preview 4 – Data Binding

by Damien White 5/27/2009 10:48:29 AM

LaptopThroughout the course of my introductory posts on ASP.NET AJAX 4.0, we looked at the new DataView control as well as the Sys.Observer class, which brings the Observer pattern to plain JavaScript objects.  The new ASP.NET AJAX release is very exciting offering powerful new features to take AJAX enabled applications to a new level.  In this post, we’ll look at another exciting feature of ASP.NET AJAX 4.0 known as “live bindings.” 

You may remember that we looked briefly at live bindings in the client templates post, but for those examples I used one-way / one-time bindings.  Today, we’ll take a closer look at live bindings and see how two-way live bindings removes the one-way / one-time binding restriction allowing us to update bound elements on our page automatically when the underlying data changes. 

Again, in this post, I’ll be using Preview 4 of the ASP.NET AJAX Library, which can be downloaded from CodePlex.  The Preview 4 version can be used in your applications today (e.g. ASP 3.5, HTML).  Keep in mind that these components are still in "preview" mode (meaning no Microsoft support), though they are usable at your own risk.  For more information, you can check out the license on CodePlex. More...

Shout it kick it on DotNetKicks.com Bookmark and Share

ASP.NET 4.0 AJAX – Preview 4 – JavaScript Observer Pattern

by Damien White 5/21/2009 11:54:00 AM

Examine In my last post on ASP.NET AJAX 4.0, we took a look at the new DataView ASP.NET AJAX control.  We saw that by using a DataView, we could easily bind data with JavaScript or declaratively with a few attributes.  In this post, we’ll look at another feature of the ASP.NET 4.0 AJAX Library, the Observer design pattern for plain JavaScript objects.  The pattern is implemented in the client side Sys.Observer class.  This feature is used internally within the new version of ASP.NET AJAX for live-binding and the DataView control.  

Here we will be using Preview 4 of the ASP.NET AJAX Library, which can be downloaded from CodePlex.  Remember that these components are still in "preview" mode (meaning no Microsoft support), though they are usable at your own risk.  For more information, you can check out the license on CodePlex.  I highly recommend downloading the samples available for Preview 4, which are also available at CodePlex.  The samples give you a good look at what is coming. 

In this post, we’ll take a closer look at the Sys.Observer class, witness the problems it solves, and take a look at a few examples.  More...

Shout it kick it on DotNetKicks.com Bookmark and Share