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 21

New Ext JS 2.1
Couple of days ago new version of Ext JS become available for download. The changes are here:
* Full REST support
* Added Ext.StatusBar Component and Samples
* Added Ext.Slider Component and Samples
* Added Example to demonstrate Remote Loading of Component Configs
* Added Grid Filtering Sample
* Added Layout Browser Sample
* Added Spotlight Sample

View full list of changes here.
Download from here.

Apr 13

SQL Server best practicesNever under estimate the load on SQL Server because it might affect overall performance.
Pinal Dave shared with us his view on 14 best practices. Here is his list if anyone wants to add something write a comment below:

1. Store relevant and necessary information in the database instead of application structure or array.

2. Use normalized tables in the database. Small multiple tables are usually better than one large table.

3. If you use any enumerated field create look up for it in the database itself to maintain database integrity.

4. Keep primary key of lesser chars or integer. It is easier to process small width keys.

5. Store image paths or URLs in database instead of images. It has less overhead.

6. Use proper database types for the fields. If StartDate is database filed use datetime as datatypes instead of VARCHAR(20).

7. Specify column names instead of using * in SELECT statement.

8. Use LIKE clause properly. If you are looking for exact match use “=” instead.

9. Write SQL keyword in capital letters for readability purpose.

10. Using JOIN is better for performance then using sub queries or nested queries.

11. Use stored procedures. They are faster and help in maintainability as well security of the database.

12. Use comments for readability as well guidelines for next developer who comes to modify the same code. Proper documentation of application will also aid help too.

13. Proper indexing will improve the speed of operations in the database.

14. Make sure to test it any of the database programming as well administrative changes.

source

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.