Apr 30

I just can’t miss that one! It comes from Matt Berseth’s blog where he describes how GridView, DetailsView and ModalPopup Controls can be nicely working together.

GridView, DetailsView and ModalPopup Controls in Master-Detail

Here is a quick quote from his post:
“I am sure everyone is pretty familiar with Master/Details style of editing data, but just in case - here is how my page works. The grid shows 12 rows of customer data. The far right column in the grid contains a hyperlink that when clicked brings the detail view of the row into focus so the corresponding row can be edited. The detail view is a popup control and contains a Save and Close buttons. When close is clicked, the detail popup is dismissed and the user goes back to viewing the main grid. When they click Save, some simple validation checks are run (all are RequiredFieldValidators for this sample) and the new data values are persisted, and finally the detail popup is dismissed and the main grid is refreshed so that it displays the changes.”

You can find the rest here. Matt has done a wonderful job sharing also the source code.

Apr 08

This isnt really new technique but when it comes to optimizing ASP.NET web pages everything is appreciated. We all know that when we put script content after UI content we will get speed improvement. But when we deal with dynamic script tags its not easy to accomplish it. Omar is getting into this describing a nice technique to filter the HTML output and get all script tags and put it at the back. Here is a link to his post.
Check out a part of his great post here:

ASP.NET ScriptManager control has a property LoadScriptsBeforeUI, when set to false, should load all AJAX framework scripts after the content of the page. But it does not effectively push down all scripts after the content. Some framework scripts, extender scripts and other scripts registered by Ajax Control Toolkit still load before the page content loads. The following screen taken from www.dropthings.com shows several script tags are still added at the beginning of

which forces them to download first before the page content is loaded and displayed on the page. Script tags pause rendering on several browsers especially in IE until the scripts download and execute. As a result, it gives user a slow loading impression as user stares at a white screen for some time until the scripts before the content download and execute completely. If browser could render the html before it downloads any script, user would see the page content immediately after visiting the site and not see a white screen. This will give user an impression that the website is blazingly fast (just like Google homepage) because user will ideally see the page content, if it’s not too large, immediately after hitting the URL.

Faster page loading in ASP.NET

From the above screen shot you see there are some scripts from ASP.NET AJAX framework and some scripts from Ajax Control Toolkit that are added before the content of the page. Until these scripts download, browser don’t see anything on the UI and thus you get a pause in rendering giving user a slow load feeling. Each script to external URL adds about 200ms avg network roundtrip delay outside USA while it tries to fetch the script. So, user basically stares at a white screen for at least 1.5 sec no matter how fast internet connection he/she has.

These scripts are rendered at the beginning of form tag because they are registered using Page.ClientScript.RegisterClientScriptBlock. Inside Page class of System.Web, there’s a method BeginFormRender which renders the client script blocks immediately after the form tag.

And here is how the HTML code looks like after manipulation:
Faster page loading in ASP.NET
Script tags are moved after the “form” tag when the filter is used

You can grab the Filter class from the App_Code\ScriptDeferFilter.cs of the Dropthings project. Go to CodePlex site and download the latest code for the latest filter.

Feb 18

We were waiting for quite some time to see this happening. After having so big variety of JavaScript libraries it was about time to see one of them build in into ASP.NET controls. Coolite has the answer!
Coolite offers dotNet and ExtJS controls

These guys are the creators of the killer app called DateJS which we wrote about way back in November. Now the continue with the good work and created Coolite suite. It includes:

* Powerful integration of the Ext JavaScript Framework.
* Full Design-Time support in Microsoft Visual Studio 2005 & 2008 and Visual Web Developer 2005 & 2008.
* Drag-and-drop ease of use.
* Current support for Window, Panel and a many Form Controls including DatePicker, Calendar and HtmlEditor.
* New Controls being added weekly.
* Dual Licensed (LGPL 3.0 and Coolite Commercial License).
* Professional support options available shortly.

Coolite offers dotNet and ExtJS controls

From the form controls they have included

* Calendar
* CheckBox
* DatePicker
* FieldSet
* HtmlEditor
* NumberTextBox
* RadioButton
* TextArea
* TextBox

Check out some examples here

Feb 09

On 8th of Feb Microsoft released a hot-fix for the latest Visual Studio 2008. Scott Guthrie blogged about that release and I can’t miss that post. On Monday will install it personally and will blog about it. Here is what it should fix:

HTML Source view performance

* Source editor freezes for a few seconds when typing in a page with a custom control that has more than two levels of sub-properties.
* “View Code” right-click context menu command takes a long time to appear with web application projects.
* Visual Studio has very slow behavior when opening large HTML documents.
* Visual Studio has responsiveness issues when working with big HTML files with certain markup.
* The Tab/Shift-Tab (Indent/Un-indent) operation is slow with large HTML selections.

Design view performance

* Slow typing in design view with certain page markup configurations.

HTML editing

* Quotes are not inserted after Class or CssClass attribute even when the option is enabled.
* Visual Studio crashes when ServiceReference element points back to the current web page.

JavaScript editing

* When opening a JavaScript file, colorization of the client script is sometimes delayed several seconds.
* JavaScript IntelliSense does not work if an empty string property is encountered before the current line of editing.
* JavaScript IntelliSense does not work when jQuery is used.

Web Site build performance

* Build is very slow when Bin folder contains large number of assemblies and .refresh files with web-site projects.

Installation Notes

For more information on how to download and install the above patch, please read this blog post here. In particular, if you are using Windows Vista with UAC enabled, make sure to extract the patch to a directory other than “c:\” (otherwise you’ll see an access denied error).

To verify that this hot-fix patch successfully installed, launch VS 2008 and select the Help->About menu item. Make sure that there is an entry that says ‘Hotfix for Microsoft Visual Studio Team System 2008 Team Suite – ENU (KB946581)’.

If you ever want to remove the patch, go to Control Panel -> Add/Remove Programs and select “Hotfix for Microsoft Visual Studio 2008 – KB946581” under Microsoft Visual Studio 2008 (or Visual Web Developer Express 2008) and click “Remove”.

Download

Here

Jan 30

Omar AL Zabir had published one of his great posts again. This one is dedicated to ASP.NET performance and scalability secrets. Here are part of his explanation words:

ASP.NET 2.0 has many secrets, when revealed, can give you big performance and scalability boost. For instance, there are secret bottlenecks in Membership and Profile provider which can be solved easily to make authentication and authorization faster. Furthermore, ASP.NET Http pipeline can be tweaked to avoid executing unnecessary code that gets hit on each and every request. Not only that, ASP.NET Worker Process can be pushed to its limit to squeeze out every drop of performance out of it. Page fragment output caching on the browser (not on the server) can save significant amount of download time on repeated visits. On demand UI loading can give your site a fast and smooth feeling. Finally, Content Delivery Networks (CDN) and proper use of HTTP Cache headers can make your website screaming fast when implemented properly. In this article, you will learn these techniques that can give your ASP.NET application a big performance and scalability boost and prepare it to perform well under 10 times to 100 times more traffic.

In that article he will cover:
* ASP.NET Pipeline optimization
* ASP.NET Process configuration optimization
* Things you must do for ASP.NET before going live
* Content Delivery Network
* Caching AJAX calls on browser
* Making best use of Browser Cache
* On demand progressive UI loading for fast smooth experience
* Optimize ASP.NET 2.0 Profile provider
* How to query ASP.NET 2.0 Membership tables without bringing down the site
* Prevent Denial of Service (DOS) attack

Read more here

Jan 24

Once again Microsoft brings some knowledge to the masses :) This time its free e-books. All the headings speak for them selfs and with few words these books are MUST HAVE for every developer. Only few chapters are included in pdf’s as you are encouraged to buy them! Here is the content:

ms_linq_cvr.jpgIntroducing Microsoft LINQ
by Paolo Pialorsi and Marco Russo

ISBN: 9780735623910

* Chapter 1: LINQ Introduction
* Chapter 2: C# Language Features
* Chapter 3: Visual Basic 9.0 Language Features
* Chapter 4: LINQ Syntax Fundamentals
* Chapter 5: LINQ to ADO.NET
* Chapter 6: LINQ to XML

ms_ajax_cvr.jpgIntroducing Microsoft ASP.NET AJAX
by Dino Esposito

ISBN: 9780735624139

* Chapter 1: The AJAX Revolution
* Chapter 5: The AJAX Control Toolkit

ms_silverlight_cvr.jpgIntroducing Microsoft Silverlight 1.0
by Laurence Moroney

ISBN: 9780735625396

* Chapter 1: Silverlight and User Experience
* Chapter 5: Programming Silverlight with JavaScript

Log into Microsoft Press home page for more info here
Jan 21

Brad Abrams just converted the existing Web Site Starter Kit from the VS 2005 web site to use the new dot Net 3.5 framework, LINQ and Ajax extenders. Here is the full source code for that.

Here are some of the key points from his post:

- VS2008 Can Target .NET Framework 2.0
- Upgrade to ASP.NET 3.5 and Take Advantage of Linq
- Ajax Enabling the Site
- Tricking out the site with the Ajax Control Toolkit

read the whole post here

Jan 07

I love reading great articles! The one I am posting today is simply deep and marvelous! Its written by the well known Jeff Prosise and is included in the last issue of MSDN Magazine.
In this article Jeff explains how to use drag and drop using ASP.NET Ajax Extensions with new Visual Studio. Here is a small part of it, at the end there is a link to the whole article:

AJAX has revolutionized Web user interfaces, and ASP.NET AJAX has made AJAX available to the Visual Studio® users. It comes in three separate downloads: ASP.NET AJAX Extensions (asp.net/ajax/downloads), which provides the core, fully tested set of AJAX functionality; ASP.NET AJAX Futures (asp.net/downloads/futures), which contains experimental features on which the product group wants feedback; and the ASP.NET AJAX Control Toolkit (asp.net/ajax/ajaxcontroltoolkit/samples), which provides a grab bag of AJAX controls as well as an SDK for building controls of your own.

Of the three, the Futures release has garnered the least attention from the developer community. That’s unfortunate because, more than providing a glimpse into what future versions of ASP.NET AJAX might look like, the Futures Community Technology Preview (CTP) is chock full of features that can be used to build cutting-edge Web apps today. A case in point is drag-and-drop.

Hidden away inside the Futures PreviewDragDrop.js file lies support for rich, browser-based drag-and-drop user interfaces. The model it uses is patterned after the old OLE drag-drop model, in which drag sources implement the IDragSource interface, drop targets implement the IDropTarget interface, and the system provides a drag-drop manager to connect drag sources to drop targets. The Futures drag-drop manager is an instance of a JavaScript class named Sys.Preview.UI._DragDropManager, which is automatically instantiated and made available through a global variable named Sys.Preview.UI.DragDropManager.

For months now, I’ve been meaning to write a sample showing how to use PreviewDragDrop.js to implement real drag-drop, featuring custom drag sourcing and custom drop targeting. I finally got around to it, and the results are pretty cool. I learned quite a lot about DragDropManager in the process, including how to enhance it by adding support for custom drag visuals. Once you’re familiar with the model (and comfortable with the concept of deriving classes and implementing interfaces in JavaScript), DragDropManager opens up a whole new world of possibilities for Web UIs.
read original

Jan 04

This one I found today, it was published on 18th of Dec by Tony Davis on http://www.simple-talk.com. Its quite interesting post I loved reading it.
Here is a short brief:
Visual Basic v9 appeared on November 19. In the past, the new release of Microsoft’s longest-running language might have caused a stir, but it was part of Microsoft .NET Framework 3.5 and there were plenty of other distractions. The changes to VB itself were pretty minor: The ‘Inline IF’ was finally retired in favour of a true ternary IF. We got support for LINQ, Lambda expressions like those of Python, support for XML Literals, and Type Inference. Hopefully, the real changes to the language will come with Visual Basic v10, which will use the Dynamic Language Runtime, and benefit from experience gained in the development of IronPython. It is set to be released with Silverlight 2 as ‘Dynamic Visual Basic’. In the meantime C# continues to increase its dominance in the .NET world. Poor JScript.NET seems to be in terminal decline despite its high quality, though it is, like VB, promised a DLR makeover for SilverLight, and is likely to be renamed ‘Managed JScript’.

For .NET scripting, things already look a lot livelier, thanks in part to the Dynamic Language Runtime (DLR). IronPython and PowerShell have, in the past year, found good solid niches, thanks to their effortless access to the CLR and, in the case of IronPython, excellent tutorials and good compatibility with existing Python code. We all hoped for more with IronRuby, which now seems to be stuck in a pre-alpha limbo due more to legal than technical problems. This is disappointing for those of us who liked some of the ideas in Ruby on Rails. While we wait for Ruby, there is Boo and Nemerle to play with.
read the whole

Dec 13

Part 4 from Bill Horst’s series, now its functions turn.

Functions

SQL SELECT clauses often involve functions, which can be scalar or aggregate. An aggregate function is applied to a field over all the selected records, while a scalar function is called with individual values, one record at a time. It is possible to re-create both kinds of functions with VB LINQ expressions, but in very different ways.

Scalar Functions

Scalar functions are called on each record with whatever parameters are specified. They can appear various places in a SQL query, such as in the SELECT clause. The Scalar Functions available differ from system to system, but usually, there will be an analogous VB method that can be used. If using a Scalar Function in a LINQ Select clause, you will probably need to specify an alias as well (FirstThreeLetters, CurrentTime).

SQL

SELECT LEFT(ItemName, 3) FirstThreeLetters, NOW() CurrentTime
FROM OrderTable

VB

From Shipment In OrderTable _
Select FirstThreeLetters = Left(Shipment.ItemName, 3), CurrentTime = Now

In the above case, Left and Now are methods already built into VB, defined in Microsoft.VisualBasic.dll. This will likely be the case for most common scalar functions you will find in SQL statements. Even if the function you wish to call does not exist in VB already, you can define your own methods, too. However, user-defined methods cannot be used in a Database query, as they will throw an exception at runtime. In the below example, MyFunction is a user-defined function called from the Select clause.

VB

From Shipment In OrderTable _
Select MyFunction(Shipment.Cost, Shipment.ShippingZip)

Aggregate Functions

Aggregate functions are called on certain fields over an entire set of records, and return one value. In a SQL statement, they can appear in the SELECT clause. With VB LINQ, this concept appears a bit differently.

A VB LINQ expression usually begins with a From clause. However, they can also begin with an Aggregate clause. The Aggregate clause has the same syntax as a From clause, except that it starts with a different keyword. If a query starts with an Aggregate clause, it must end with an Into clause. An Into clause is a comma-delimited list of Aggregate function calls, with aliases that can accompany them. The below example shows a SQL SELECT statement that uses Aggregate functions, and an equivalent VB LINQ expression.

SQL

SELECT SUM(Cost) TotalCost, COUNT(*)
FROM OrderTable
WHERE OrderDate > “Sept-29-2007

VB

Aggregate Shipment In OrderTable _
Where Shipment.OrderDate > #9/29/2007# _
Into TotalCost = Sum(Shipment.Cost), Count()

read source