BusinessRx Community

Dedicated to the advancement of software, technology and the people who devote their lives to it.

Welcome to BusinessRx Community Sign in | Join | Help
in Search

BusinessRx Reading List

These blog entries are written by industry experts and leaders. We consider this content to be a good read for any software developer or web technologist.

Browse by Tags

All Tags » .NET » Community News » Atlas   (RSS)

  • jQuery Intellisense in VS 2008

    Last month I blogged about how Microsoft is extending support for jQuery.  Over the last few weeks we've been working with the jQuery team to add great jQuery intellisense support within Visual Studio 2008 and Visual Web Developer 2008 Express (which is free).  This is now available to download and use.

    Steps to Enable jQuery Intellisense in VS 2008

    To enable intellisense completion for jQuery within VS you'll want to follow three steps:

    Step 1: Install VS 2008 SP1

    VS 2008 SP1 adds richer JavaScript intellisense support to Visual Studio, and adds code completion support for a broad range of JavaScript libraries.

    You can download VS 2008 SP1 and Visual Web Developer 2008 Express SP1 here.

    Step 2: Install VS 2008 Patch KB958502 to Support "-vsdoc.js" Intellisense Files

    Two weeks ago we shipped a patch that you can apply to VS 2008 SP1 and VWD 2008 Express SP1 that causes Visual Studio to check for the presence of an optional "-vsdoc.js" file when a JavaScript library is referenced, and if present to use this to drive the JavaScript intellisense engine.

    These annotated "-vsdoc.js" files can include XML comments that provide help documentation for JavaScript methods, as well as additional code intellisense hints for dynamic JavaScript signatures that cannot automatically be inferred.  You can learn more about this patch here.  You can download it for free here.

    Step 3: Download the jQuery-vsdoc.js file

    We've worked with the jQuery team to put together a jQuery-vsdoc.js file that provides help comments and support for JavaScript intellisense on chained jQuery selector methods.  You can download both jQuery and the jQuery-vsdoc file from the official download page on the jQuery.com site:

    Save the jquery-vsdoc.js file next to your jquery.js file in your project (and make sure its naming prefix matches the jquery file name):

    You can then reference the standard jquery file with an html <script/> element like so:

    Or alternatively reference it using the <asp:scriptmanager/> control, or by adding a /// <reference/> comment at the top of a standalone .js file. 

    When you do this VS will now look for a -vsdoc.js file in the same directory as the script file you are referencing, and if found will use it for help and intellisense.  The annotated

    For example, we could use jQuery to make a JSON based get request, and get intellisense for the method (hanging off of $.):

    As well as help/intellisense for the $.getJSON() method's parameters:

     

    The intellisense will continue to work if you nest a callback function within the method call.  For example, we might want to iterate over each JSON object returned from the server:

    And for each of the items we could execute another nested callback function:

    We could use the each callback function to dynamically append a new image to a list (the image src attribute will point to the URL of the returned JSON media image):

    And on each dynamically created image we could wire-up a click event handler so that when it is pressed it will disappear via an animation:

    Notice how the jQuery intellisense works cleanly at each level of our code. 

    JavaScript Intellisense Tips and Tricks

    Jeff King from the Web Tools team wrote up a great post earlier this week that answers a number of common questions about how JavaScript intellisense works with VS 2008.  I highly recommend reading it.

    One trick he talks about which I'll show here is a technique you can use when you want to have JavaScript intellisense work within user-controls/partials (.ascx files).  Often you don't want to include a JavaScript library <script src=""/> reference  within these files, and instead have this live on the master page or content page the user control is used within.  The problem of course when you do this is that by default VS has no way of knowing that this script is available within the user control - and so won't provide intellisense of it for you.

    One way you can enable this is by adding the <script src=""/> element to your user control, but then surround it with a server-side <% if %> block that always evaluates to false at runtime:

    At runtime ASP.NET will never render this script tag (since it is wrapped in an if block that is always false).  However, VS will evaluate the <script/> tag and provide intellisense for it within the user-control.  A useful technique to use for scenarios like the user control one.  Jeff has even more details in his FAQ post as well as his original jQuery intellisense post.  Rick Strahl also has a good post about using jQuery intellisense here.

    More Information

    To learn more about jQuery, I recommend watching Stephen Walther's ASP.NET and jQuery PDC talk. Click here to download his code samples and powerpoint presentation.

    Rick Strahl also has a really nice Introduction to jQuery article that talks about using jQuery with ASP.NET.  Karl Seguin has two nice jQuery primer posts here and here that provide shorter overviews of some of the basics of how to use jQuery. 

    I also highly recommend the jQuery in Action book.

    Hope this helps,

    Scott

  • October 10th Links: ASP.NET, ASP.NET AJAX, jQuery, IIS

    Here is the latest in my link-listing series.  Also check out my ASP.NET Tips, Tricks and Tutorials page and Silverlight Tutorials page for links to popular articles I've done myself in the past.

    ASP.NET

    • ASP.NET Dynamic Data Videos using VB: Bill Burrows has put together an awesome series of videos that show off how to use the new ASP.NET Dynamic Data support provided in .NET 3.5 SP1.  You can find more links to ASP.NET Dynamic Data tutorials in my last link post here.

    • Routing with WebForms: Wally McClure has a nice podcast that describes how to use the new ASP.NET routing infrastructure in .NET 3.5 SP1 with Web Forms based pages.  A lot of people mistakenly think this feature only works with ASP.NET MVC applications - when in reality it also works with web forms pages (in fact all ASP.NET Dynamic Data sites use it).

    ASP.NET AJAX and jQuery

    • An Introduction to jQuery (Part 1): Rick Strahl has posted an excellent article that introduces jQuery, and walks-through how to take advantage of it within ASP.NET pages.

    • New AJAX Support for Data-Driven Web Apps: Bertrand Le Roy has written a great MSDN article that describes some of the new ASP.NET AJAX features available in preview form today.  Also check out his blog posts here and here to learn more about how the new client-side data templating feature support.

    • ASP.NET AJAX: Enabling Bookmarking and the Browser's Back Button: Scott Mitchell continues his excellent series on ASP.NET AJAX and discusses how to add history points to an AJAX-enabled web page so that visitors can bookmark it, as well as to enable back/forward browser navigation.  This is a new feature added to ASP.NET in .NET 3.5 SP1.

    Microsoft Web Platform

    Hope this helps,

    Scott

  • jQuery and Microsoft

    jQuery is a lightweight open source JavaScript library (only 15kb in size) that in a relatively short span of time has become one of the most popular libraries on the web.

    A big part of the appeal of jQuery is that it allows you to elegantly (and efficiently) find and manipulate HTML elements with minimum lines of code.  jQuery supports this via a nice "selector" API that allows developers to query for HTML elements, and then apply "commands" to them.  One of the characteristics of jQuery commands is that they can be "chained" together - so that the result of one command can feed into another.  jQuery also includes a built-in set of animation APIs that can be used as commands.  The combination allows you to do some really cool things with only a few keystrokes.

    For example, the below JavaScript uses jQuery to find all <div> elements within a page that have a CSS class of "product", and then animate them to slowly disappear:

    As another example, the JavaScript below uses jQuery to find a specific <table> on the page with an id of "datagrid1", then retrieves every other <tr> row within the datagrid, and sets those <tr> elements to have a CSS class of "even" - which could be used to alternate the background color of each row:

    [Note: both of these samples were adapted from code snippets in the excellent jQuery in Action book]

    Providing the ability to perform selection and animation operations like above is something that a lot of developers have asked us to add to ASP.NET AJAX, and this support was something we listed as a proposed feature in the ASP.NET AJAX Roadmap we published a few months ago.  As the team started to investigate building it, though, they quickly realized that the jQuery support for these scenarios is already excellent, and that there is a huge ecosystem and community built up around it already.  The jQuery library also works well on the same page with ASP.NET AJAX and the ASP.NET AJAX Control Toolkit.

    Rather than duplicate functionality, we thought, wouldn't it be great to just use jQuery as-is, and add it as a standard, supported, library in VS/ASP.NET, and then focus our energy building new features that took advantage of it?  We sent mail the jQuery team to gauge their interest in this, and quickly heard back that they thought that it sounded like an interesting idea too.

    Supporting jQuery

    I'm excited today to announce that Microsoft will be shipping jQuery with Visual Studio going forward.  We will distribute the jQuery JavaScript library as-is, and will not be forking or changing the source from the main jQuery branch.  The files will continue to use and ship under the existing jQuery MIT license.

    We will also distribute intellisense-annotated versions that provide great Visual Studio intellisense and help-integration at design-time.  For example:

    and with a chained command:

    The jQuery intellisense annotation support will be available as a free web-download in a few weeks (and will work great with VS 2008 SP1 and the free Visual Web Developer 2008 Express SP1).  The new ASP.NET MVC download will also distribute it, and add the jQuery library by default to all new projects.

    We will also extend Microsoft product support to jQuery beginning later this year, which will enable developers and enterprises to call and open jQuery support cases 24x7 with Microsoft PSS.

    Going forward we'll use jQuery as one of the libraries used to implement higher-level controls in the ASP.NET AJAX Control Toolkit, as well as to implement new Ajax server-side helper methods for ASP.NET MVC.  New features we add to ASP.NET AJAX (like the new client template support) will be designed to integrate nicely with jQuery as well. 

    We also plan to contribute tests, bug fixes, and patches back to the jQuery open source project.  These will all go through the standard jQuery patch review process.

    Summary

    We are really excited to be able to partner with the jQuery team on this.  jQuery is a fantastic library, and something we think can really benefit ASP.NET and ASP.NET AJAX developers.  We are looking forward to having it work great with Visual Studio and ASP.NET, and to help bring it to an even larger set of developers.

    For more details on today's announcement, please check out John Resig's post on the jQuery team blog.  Scott Hanselman is also about to post a nice tutorial that shows off integrating jQuery with ASP.NET AJAX (including the new client templating engine) as well as ADO.NET Data Services (which shipped in .NET 3.5 SP1 and was previously code-named "Astoria").

    Hope this helps,

    Scott

  • Using VS 2008 to Create New ASP.NET 2.0 with ASP.NET AJAX 1.0 Projects

    One of the great new features of VS 2008 is its support for framework multi-targeting.  This enables you to use VS 2008 on .NET 2.0, .NET 3.0 and .NET 3.5 projects, and does not require you to upgrade your projects to the latest version of the .NET Framework in order to take advantage of new Visual Studio 2008 features (like JavaScript Intellisense, JavaScript Debugging, code editing, nested master pages, and the improved web designer and CSS features - all of which work with .NET 2.0, 3.0 and 3.5 projects).

    ASP.NET AJAX 1.0 Multi-Targeting Support

    VS 2008 out of the box allows you to open and edit existing ASP.NET 2.0 applications built with the separate ASP.NET AJAX 1.0 download we shipped last year.  The VS 2008 multi-targeting support works just fine with these projects, and you can use the improved JavaScript and web designer support with them - while still targeting .NET 2.0 and ASP.NET AJAX 1.0.

    New ASP.NET AJAX 1.0 Project Templates for VS 2008

    Out of the box VS 2008 doesn't include project templates for creating brand new ASP.NET 2.0 with ASP.NET AJAX 1.0 applications.  Right before Christmas we shipped a web free web download for VS 2008 that enables these project templates options.  You can download them here (note: you also need to make sure you have ASP.NET AJAX 1.0 installed on your machine in order to use them). 

    Once these additional project templates are installed, you can use File->New Project or File->New Web Site within VS 2008 to create ASP.NET AJAX 1.0 applications that run on ASP.NET 2.0:

    New ASP.NET AJAX 1.0 Web Site:

    New ASP.NET AJAX 1.0 Web Application:

    Applications built using these project templates do not require .NET 3.5 to be installed on a server in order to work - you can copy them to any existing web server that has .NET 2.0 and ASP.NET AJAX 1.0 installed and they will work fine.

    Hope this helps,

    Scott

  • ASP.NET AJAX Control Toolkit and Web Deployment Project Releases for VS 2008

    This week my team released updates of the ASP.NET AJAX Control Toolkit as well as the Visual Studio Web Deployment project packager.  Both of these updates are designed to work with VS 2008 and .NET 3.5.

    ASP.NET AJAX Control Toolkit

    The ASP.NET AJAX Control Toolkit is a free download and contains more than 40 additional AJAX controls and components that work on top of the core ASP.NET AJAX functionality now built-into .NET 3.5 (and available as a separate download for ASP.NET 2.0).  In addition to having Microsoft developers contribute, the project also has dozens of non-Microsoft contributors adding great features and controls. 

    The ASP.NET AJAX Control Toolkit update shipped this week fixes some issues that people were running into when using the control toolkit's extender controls with the VS 2008 Web designer.  The only change made was to adjust the version string number of the control toolkit assemblies (David Anson has more details of the change here).  I'd definitely recommend downloading the update if you are using VS 2008 or Visual Web Developer 2008 Express.

    You can also find a steady stream of articles about ASP.NET AJAX and the ASP.NET AJAX Control Toolkit via my Link Listing series (in particular check my post here for a dedicated ASP.NET AJAX link post).  Also read my previous post on using ASP.NET AJAX Control Extenders in VS 2008 to learn more about the integrated design-time support that you now get with the ASP.NET AJAX Control Toolkit in VS 2008 and Visual Web Developer 2008 Express. 

    Lastly, check out the great ASP.NET AJAX videos on the www.asp.net site here and here.

    Visual Studio 2008 Web Deployment Project Support

    Late last night my team also posted the VS 2008 Web Deployment project download option for VS 2008.  Web Deployment projects can be used with either the "Web Site" or "Web Application Project" options built-into VS 2008, and provide a few additional build, packaging and deployment options for you to use.  You can read an old tutorial post of mine here to learn more about they work.

    This week's VS 2008 Web Deployment Project download supports all of the existing features provided by the VS 2005 web deployment download.  It also adds additional support for:

    • Easily migrating VS 2005 Web Deployment Projects to VS 2008 Web Deployment Projects
    • Replacing output only if web deployment builds succeed
    • IIS7 Support

    You can learn more about this week's download here and download it directly here.  We are calling this week's download the "December CTP" so that we can incorporate feedback on the new features.  We are then going to ship the final release on the web next month.

    Hope this helps,

    Scott

  • September 16th Links: ASP.NET, ASP.NET AJAX, IIS7, Visual Studio, Silverlight

    Here is the latest in my link-listing series.  Also check out my ASP.NET Tips, Tricks and Tutorials page for links to popular articles I've done myself in the past.

    ASP.NET

    • Debugging Script: Dumping out Current and Recent ASP.NET Requests: Tess Ferrandez from the ASP.NET support team has an excellent post that details how to use the windbg debugger to dump out real-time information about what requests ASP.NET is currently processing on the server (super useful when investigating failures).  She has a great script you can just run "as-is" in this article, as well as an in-depth discussion about how it works.
    • Freezing GridView Column Headers with CSS and a Control Adapter: Matt Berseth has a cool article on how you can use CSS to implement a "frozen columns headers" feature with the standard <asp:gridview> control.  Note that this type of scenario is much easier with the new <asp:listview> control in .NET 3.5, which enables you to customize all of the html markup emitted.

    ASP.NET AJAX

    • Update for the iPhone: Matt Gibbs blogs about a fix you can apply to ASP.NET AJAX to address a change in the iPhone 1.01 patch that impacts how regular expressions are parsed in the iPhone Safari browser.  Matt's fix enables you to continue targeting iPhone users with your ASP.NET AJAX applications.

    Visual Studio

    • XML to Schema Inference Wizard for Visual Studio 2008: Scott Hanselman has a great blog post about a new item template wizard that makes it really easy to automatically infer an XML schema from a XML file or XML snippet.  He then shows how you can use the cool new LINQ to XML features in VB9 to get automatic LINQ to XML intellisense inside VS 2008 with it.

    IIS 7.0

    • Ten Reasons why IIS 7.0 Rocks: The Microsoft.com team has been running the entire www.microsoft.com site on IIS7 and Windows Server 2008 the last few months.  This blog post from them lists their top 10 favorite improvements in IIS7.

    Silverlight

    • Ink Recognition and Silverlight: Loren has a really cool sample built with Silverlight that demonstrates how you can use the ink pen recognition support within Silverlight to enable tablet or mouse based Google searches using a Silverlight application.  A very cool mashup.
    • Silverlight Spy Tool: Silverlight Spy is a small WinForms application capable of inspecting Silverlight 1.0 applications.  You can use it to navigate a XAML object explorer of a running Silverlight application, trace out messages from it, and enable easier debugging of it.
    • HtmlTextBlock control for Silverlight: David Anson has published a really cool control for Silverlight 1.1 that provides an easy way to take HTML input and display it using the text/graphics stack within Silverlight.
    • Silverlight Dev Camp Chicago: Kevin Marshall is organizing an upcoming Silverlight DevCamp event in Chicago on September 28th-29th.  You can attend completely for free.

    Hope this helps,

    Scott

  • Updated ASP.NET AJAX Control Toolkit Release and New ASP.NET AJAX Videos/Articles

    Last week the ASP.NET AJAX Control Toolkit team released Build 10618 of the ASP.NET AJAX Control Toolkit.  This fixed a few issues discovered with the release earlier this month including:

    • A fix for the Tabs naming container
    • A fix for a VS design-time dependency
    • FilteredTextBox Navigation and control key issues

    This build also contains additional performance optimizations for the new "script combining" feature provided by the new ToolkitScriptManager control.  This feature can help significantly improve performance for pages with multiple AJAX scripts that previously needed to be downloaded separately.  David Anson has a nice blog post that talks about these improvements here.

    New ASP.NET AJAX Videos

    Joe Stagner has recently posted five new (free) ASP.NET AJAX videos on www.asp.net:

    You can download and watch the videos here.  These new videos are available to download in a variety of video and audio formats including: WMV, Zune, iPod, PSP, MPEG-4, and 3GP.

    New ASP.NET AJAX Articles

    Here are a few recent ASP.NET AJAX articles you might also want to check out:

    • ASP.NET AJAX UpdatePanel Tips and Tricks: This is a great MSDN Magazine article by Jeff Prosise that covers: update highlighting, how to cancel updatepanel updates, optimizing with conditional updatepanels, and using page methods.
    • AJAX Control Toolkit Patch Utility: If you are not an official contributor to the ASP.NET AJAX Control Toolkit project, but would like to submit a bug fix or small feature into the toolkit, you can read this article to learn how to create and submit a patch to the team for them to review and potentially include.

    ASP.NET AJAX 1.0 Books

    As I've mentioned in other recent posts, the first books specifically targeting the final ASP.NET AJAX 1.0 release were recently published.  Below are links to two of them that are shipping today:

    Both books also include a chapter on using the controls within the ASP.NET AJAX Control Toolkit.

    Hope this helps,

    Scott

  • ASP.NET AJAX 1.0 Source Code Released

    As I mentioned last week when ASP.NET AJAX 1.0 shipped, we are publishing the full source code to the ASP.NET AJAX product.  This includes the source to the server-side ASP.NET integration (including the UpdatePanel, UpdateProgress, and ScriptManager controls, as well as the source to the Network Serialization code).

    The client-side ASP.NET AJAX JavaScript library (which we also call the "Microsoft AJAX Library") is being released under the Microsoft Permissive License (Ms-PL).  This grants developers the right to freely customize/modify the library, as well as to redistribute the derivative versions of the JavaScript library for both commercial and non-commercial purposes. 

    The code for the server-side ASP.NET AJAX 1.0 implementation was released this morning.  You can download it here.  It is being released under the Microsoft Reference License (Ms-RL).  Included with the source code are debugger symbols for the shipped binary, which will allow you to step from your own code into the ASP. NET AJAX library while debugging, with line number and symbol data preserved.  Note that the setup installs the source code locally on your machine within the "\Program Files\Microsoft ASP.NET\ASP.NET 2.0 AJAX Extensions\v1.0.61025\Source" directory.

    You can also obviously download (and modify) the source code for the ASP.NET AJAX Control Toolkit.  It is built as a collaborative CodePlex Project that both Microsoft and non-Microsoft developers contribute code and work on together.

    Thanks,

    Scott 

    P.S. I'm hoping on a plane to Europe in an hour for my presentations in Belgium and the UK, and will be out the rest of this week (it only took me 3 frantic hours to find my passport last night -- sheesh).  As a result there will be some delays with blog comments (and my responses to them) while I'm away. 

     

  • Atlanta C# User Group features Greg and Wally on August 7th

    The Atlanta C# User Group is meeting on Monday, August 7, 2006, at 6:00 pm at the Microsoft offices in Alpharetta.  Greg Young will present the design patterns of the month, followed by Wally McClure presenting on Ajax and Atlas.  See you there.
    Share this post: Email it! | bookmark it! | digg it! | reddit!
Powered by Community Server, by Telligent Systems
'