Manual Sorting with ListView by Using Drag and Drop
Introduction
I have been following Matt’s jQuery related posts, and trying to get myself familiar with this new library. While searching for tutorials about it, I accidentally found this great blog. Accident followed by another accident, I figured out that one of their JavaScript posts can be applicable to the ListView control in order to create a “drag and drop” based manual sorting within the items of the ListView.
• I strongly suggest reading the original post first before passing to the rest of this post.
Implementing The Original Post…

As a data source, I just grabbed the XML file that I used before in here, and simplified it.

Here is the CSS implementation of the original post into my sample ASPX page:

And then, I created the DIVs programmatically by using a ListView as in the following:

If you look at the JavaScript.js file that I used in my sample code, you will see that the load function has been commented since I needed to create the “dragObject” objects dynamically in that function:

As a result of this, I organized the Page_Load event as:

Download
You can download the sample application via here.
Maintain Scrollbar Position Inside UpdatePanel After Partial PostBack
I have recently figured out that if there is a scrollbar’ed Panel control inside an UpdatePanel, it looses its scrollbar position after any type of partial postback within that UpdatePanel. There can be a GridView, a DIV container or another similar control instead of this Panel.
I have searched and found some workarounds at ASP.NET forums, and this specific one was the easiest one to implement into every situation in order to gain back the position of scrollbar. I enhanced it a bit by handling null cases and using the ClientID property. Here is the result:
Update
You can read the “Reusable JavaScript Component” version of this post in here. Thanks Matt!
DefaultDotAspx.com Is Launched…
DefaultDotAspx.com said “Hello world!” to the ASP.NET community.
What is it?
You can use DefaultDotAspx.com to get ready for the interviews or evaluate your knowledge. It is kind of a small knowledge base about ASP.NET and other topics. It has some short quizzes about ASP.NET and SQL as well.
There are tons of sites like this. So what?
Well… It is developed with the perspective of an ASP.NET development experience, therefore the content is dedicated accordingly. Even though it does not matter to the end-users, it was - and is being - developed by the latest version 3.5 and its new features.
Enhancing Paging in ListView by Using DataPager
DataPager is one of the new controls in ASP.NET 3.5, and it provides paging functionality for data-bound controls that implement the IPageableItemContainer interface, which is only the ListView control for the time being.
By default, DataPager has two commonly used paging styles:
• Numeric Pager via NumericPagerField
• Next and Previous Pager via NextPreviousPagerField
To get an idea about how to implement these basic common styles, you can read this post.
This post will explain how to enhance the paging experience in a ListView by using both a NextPreviousPagerField and a DropDownList which will enable users to select the page size of ListView. This page size is actually the PageSize property of the DataPager, and this property defines the number of records that are displayed for each page of ListView.
To avoid complexity, the following simple XML file (Contacts.xml) will be used as a data source:

And, the XMLDataSource that consumes this XML file is:

“xdsDemo” is the DataSourceID of the ListView “lvDemo”:

After getting this data binding done, LayoutTemplate of “lvDemo” should be similar to the following:

Even though it is not completely related with the topic and emphasis of this post, ItemTemplate and AltenatingItemTemplate templates of “lvDemo” are:

Finally, here is the code that sets DropDownList (ddlDemo) and DataPager (dpDemo):

As a conclusion of all these things, the result on the browser should be like:

Download
Sample code for this demo application can be downloaded via here.
Update Title and Meta Tags Dynamically in ASP.NET
If you are using master pages, updating your title or meta tags (such as “description” and “keywords”) may become an important subject because of the SEO purposes. Since there are several ways to accomplish this, here is my way in C# to do so.
