At the end of the previous month I wrote a posting on DefensiveDatasource class that can be used to associate ASP.NET's GridView with collections containing objects of different types and based on one and the same base class. Dividing data into pages in GridView does, however, not succeed. An error message "The data source does not support server-side data paging" is displayed.


NB! This blog is moved to

Click here to go to article


  • Can you send me your e-mail address? I have binaries of this class in my source code repository.

  • Thank you, Aredhel! :)

  • This solution has a drawback : if your grid use template fields, with custom binding relying on manipulating your base class, you will get an invalid cast exception.
    The defensivedatasource made your grid bound to an object type which is not derivate from your original base type in your list.

    Personally, I have ended up reimplementing a custom hyperlinkfield polymorphism aware. And I used it instead of the vanilla hyperlinkfield.

    This suppose to supply custom field for any vanilla field that does not support polymorphism (I do not know a list of such fields).

Comments have been disabled for this content.