Archives / 2009 / January
  • Implementing Sorting in Generic List (List<T>)

    How to sort a generic list? Well, generic list provides a sort method itself in the form List<T>.Sort(). But wait a sec. This method requires you to implement sorting mechanism in your type. This is because this method uses default sorting mechanism. This is really simple, but what if you don't have sorting mechanism in your type? In that case this method throws InvalidOperationExpression.

  • Implementing Delete Confirmation Dialog in ListView Control (ASP.Net)

    Listview control is one of my favorite controls added in version 3.5. It provides easy way to implement view (list), update, insert and delete functionality. Using SQL Data Source or LINQ Data Source control, you can create a page that will display data from database in your desired format. It will also allow you to edit, insert or delete a record from the listview itself. And the good part is that you don't need to write any code. This may be disappointing to a hard core programmer like me. But again this saves lot of development time.