November 10, 2010

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.

Giving me +1 tells me you liked this article! Thanks in advance


Did you like this post?
kick it on DotNetKicks.com Save on Delicious
subscribe via rss subscribe via e-mail
print this post follow me on twitter


About The Author

Suprotim Agarwal, ASP.NET Architecture MVP works as an Architect Consultant and provides consultancy on how to design and develop Web applications.

Suprotim is also the founder and primary contributor to DevCurry, DotNetCurry and SQLServerCurry. He has also written an EBook 51 Recipes using jQuery with ASP.NET Controls.

Follow him on twitter @suprotimagarwal

comments

11 Responses to "ASP.NET GridView Tips and Tricks Collection"
  1. Trevin said...
    November 10, 2010 at 11:28 AM

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

  2. Anonymous said...
    November 10, 2010 at 1:47 PM

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

  3. Suprotim Agarwal said...
    November 10, 2010 at 3:09 PM

    Trevin: Glad you liked the GridView tips

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

  4. Anil Jadhav said...
    November 16, 2010 at 3:47 AM

    awesome...thanks

  5. Anonymous said...
    November 18, 2010 at 7:18 AM

    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!

  6. Surya said...
    November 18, 2010 at 8:38 AM

    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

  7. Suprotim Agarwal said...
    November 18, 2010 at 8:38 AM

    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

  8. Anonymous said...
    November 18, 2010 at 3:14 PM

    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...

  9. evden eve nakliyat said...
    November 20, 2010 at 11:00 AM

    thanks for blog

  10. Amador Antonio said...
    May 10, 2011 at 7:50 AM

    Thanks for your articles, they helped me a lot!

  11. evden eve nakliyat said...
    June 10, 2011 at 7:05 AM

    asp.net kullanışlı kulay bir sistemdir

 

Copyright © 2009-2013 All Rights Reserved for DevCurry.com by Suprotim Agarwal | Terms and Conditions