ASP.NET GridView Tips and Tricks Collection

ASP.NET GridView is the most commonly used Data Control in the ASP.NET Control Toolkit. The forums are flooded with questions about using the GridView control.

I thought of starting a new series of articles on the ASP.NET GridView control to help out fellow developers. I will be updating this page with new tips as frequently as possible. I plan to write 100 GridView tips covering the most frequently asked questions on the ASP.NET GridView.

So Subscribe to RSS and stay updated when a new Tip is added. Also please retweet this post and let your fellow developers know about this series.

Let the learning begin!

Tip 1: Create an ASP.NET GridView Paging Style programmatically

Tip 2: Generate THead and TBody tags in the ASP.NET GridView

Tip 3: Check if SQLDataSource returns empty data

Tip 4: Pass ID of the ASP.NET GridView Row to a PopUp window

Tip 5: Apply CSS to a GridView Row based on a condition

Tip 6: Refresh an ASP.NET GridView automatically at regular intervals

Tip 7: Hide Selected Row in an ASP.NET GridView

Tip 8: Add a Key Up Event to all TextBoxes in an ASP.NET GridView or Table control

Tip 9: Loop through all the rows in all the pages of an ASP.NET GridView

Tip 10: Display an Image for EmptyData in an ASP.NET GridView

Tip 11: Change DateFormat In an ASP.NET GridView

Tip 12: Display Message On MouseOver In an ASP.NET GridView

Tip 13: Hiding a Column in an ASP.NET GridView

Tip 14: Prevent Word Wrap in an ASP.NET GridView

Tip 15: Find all the Checked Checkboxes in ASP.NET GridView

Tip 16: Add an Image Command Field to ASP.NET GridView at runtime

Tip 17: Import Excel Data Into An ASP.NET GridView using OLEDB

Tip 18: Import Excel Data Into an ASP.NET GridView using Microsoft.Office.Interop.Excel

Tip 19: Retrieve Rows Selected Using CheckBox in an ASP.NET GridView

Tip 20: Check Uncheck all CheckBoxes in an ASP.NET GridView using jQuery

Tip 21: Check Uncheck all CheckBoxes in an ASP.NET GridView kept in an Update Panel using jQuery

Tip 22: Programmatically Load a GridView Row in Edit Mode

Tip 23: Set the Line Color Between Rows in an ASP.NET GridView

Tip 24: Display the details of the GridView Row being Deleted and Cancel the delete operation

Tip 25: Bind ASP.NET GridView to a Custom Object or Collection with Paging and Sorting

Tip 26: Set Width of GridView TextBox in Edit mode

Tip 27: Merge GridView Header Columns

Tip 28: ASP.NET GridView Data Caching

Tip 29: ASP.NET GridView Sorting with Image

Tip 30: Change Background Color of GridView Cell using jQuery

Tip 31: Add an Auto Generated Row Number to the ASP.NET GridView

Tip 32: Bind CheckBox in ASP.NET GridView – Multiple ways

Tip 33: ASP.NET GridView Row Count with ObjectDataSource

Tip 34: Highlight Current Page in ASP.NET GridView Pager

Tip 35: Align ASP.NET GridView Column Text

Tip 36: Display Page count in ASP.NET GridView

Tip 37: Cancel Update and Delete in ASP.NET GridView

Tip 38: Sort the ASP.NET GridView Columns using jQuery TableSorter plugin

 Watch out for more tips as I update this post regularly. Please retweet this post and let your fellow developers know about this series.

I am writing this post to benefit as many developers as I can. Feel free to use the comments section and request for a GridView tip.

11 comments:

  1. Very handy collection of tips, I look forward to reading more!

    ReplyDelete
  2. Great tips, thanks. Question though: How exactly are tips #10 and #25 different?

    ReplyDelete
  3. Trevin: Glad you liked the GridView tips

    Anonymous: My bad! I have removed Tip 25 as it was the same as Tip 10. Thanks!

    ReplyDelete
  4. I think if you had a trick to keep the headings static while making the rest of the grid scrollable you would make millions of developers happy. (I've seen the quick and dirty css javascript expression version, but I believe it becomes obsolete with IE 8 and above) I've also seen making a table over the top with static heading sizes, then hide the gridview headings, but it looks horrible if you don't know the size of your data coming back(ex. a notes field). Perhaps I am asking for too much? I've also seen a jquery version, but the headings are just a wee bit off centered so you can see the data scroll behind it. Thanks!

    ReplyDelete
  5. Hi Suprotim Agarwal,

    Thanks a lot could u plz give some tips how to create a captcha & how to create a search button....if you could help me out I would be highly thankful to you.

    Best Regards,
    Surya Pratap Singh

    ReplyDelete
  6. I had written an article on Fixed Headers using jQuery. Although it's not perfect, it does serve the purpose most of the times

    Creating Fixed Headers in an ASP.NET GridView using jQuery

    ReplyDelete
  7. Its a shame that gridview is basically unusable due to its use of javascript based LinkButtons for paging and sorting...

    Gridview is not the only one and its a shame that Microsoft failed to fix this in 4.0...

    ReplyDelete
  8. Thanks for your articles, they helped me a lot!

    ReplyDelete
  9. asp.net kullanışlı kulay bir sistemdir

    ReplyDelete