22 GridView Tips and Tricks by Sheo Narayan

SheoNarayan
Posted by in ASP.NET category on for Intermediate level | Points: 250 | Views : 61751 red flag
Rating: 5 out of 5  
 5 vote(s)

In this article, we have consolidated all the GridView related articles covering many concepts which would serve as one stop reference.

Introduction of GridView

One can't imagine any .NET web application without GRIDVIEW. Undoubtedly it is most widely used
control from .NET framework. Even after its widespread acceptance, this is a control which programmer
find it little difficult to play with and achieve their specific needs.The reasons could be the complexity
and sheer span of funtionalities it offeres. Apart from displaying the data, it enables to manipulate data, present data as per need, sorting and pagination & worth to mention the customization.This is a true successor of the datagrid which belonged to earlier frameworks.

Get 500+ ASP.NET web development Tips & Tricks and ASP.NET Online training

In this post, I am going to enlist my GridView related articles for quick reference. Do not forget to bookmark this post to help you find ready-made solutions to the GridView related issues /challenges you face in day to day life as an ASP.NET developer.

1. How to populate GridView from code behind?

In this article, we shall learn how to populate GridView from the code behind using a data source.

2. How to sort the GridView data?

In this article, we shall see how to sort the GridView data.

3. How to do pagination for the GridView data?

In this article, we are going to learn how to do paginations to display large number of records on the page using GridView.

4. How to write message when there is no data to display in GridView?

In this article, we shall learn how to display a custom message when no records to display in the GridView.

5. How to select a GridView row and persist the selected record in the GridView?

In this article, we shall learn how to select GridView record and persisit the selection across different pages of the GridView.

6. How to select multiple records from GridView and retrieve selected records value?

In this article we are going to learn how to select multiple records from the GridView and retrieve selected records, we can follow this approach.

7. How to select multiple records from the GridView and persist the selection during pagination?

In this article, we shall see how to select multiple records from the GridView and persist the selection across different pages.

8. How to select all records (checkboxes for each record)?

In this article, we shall learn how to select all records from the GridView using CheckBox.

9. How to generate edit, delete, update and select buttons automatically?

In this article, we shall learn how to generate Edit, Delete, Update and Select buttons automatically in the GridView.

10. How to perform (CRUD) Edit, Update, and Delete operation in GridView?

In this article, we shall learn how to perform CRUD operation (create, read, update and delete) operation in GridView.

11. How to add a button with custom command name and perform an operation?

In this article, we shall learn how to add a button for each record in the GridView and perform some custom operation on click of the button.

12. How to delete multiple selected records from the GridView?

In this article, we shall learn how to delete multiple selected records from the GridView.

13. How to do custom pagination in the GridView to achieve better performance in case we have large number of data to display?

In this article, we shall learn how to do custom pagination in the GridView (Useful for listing large number of records) or to do SEO friendly pagination for the GridView.

14. How to work with the nested GridView (a GridView inside another GridView) and populate the data?

In this article, we shall learn how to work with (access) nested GridView (a GridView inside another GridView).

15. How to display mouseover effect on GridView rows using CSS?

In this article, we shall learn how to display mouseover effect on the GridView rows.

16. How to get the primary key value of the GridView rows in JavaScript or popup page?

In this article, we shall learn how to get the primary key value of the GridView records in JavaScript.

17. Saving images into the database in asp.net and displaying to the GridView

In this article, we shall learn how to save an image file (picture) into the database and show them in the GridView.

18. DropDownList in the GridView - Keeping asp.net forms control in GridView

In this article, I have described the ways of keeping DropDownList in the GridView and binding the data by preserving the default SelectedValue. Apart from DropDownList, I have also shown how to keep CheckBox, RadioButtonList, TextBox in the GridView and preserving the default data.

19. ASP.NET GridView + jQuery tips and tricks - Part 1

This article demonstrate how to do CRUD operation using GridView and jQuery seamlessly (without page refresh) and also describes some simple UI effects in ASP.NET GridView control using jQuery. 

20. ASP.NET GridView + jQuery tips and tricks - Part 2

This article demonstrate how to do CRUD operation using GridView and jQuery seamlessly (without page refresh) and also describes some simple UI effects in ASP.NET GridView control using jQuery. 

21. How to insert record using GridView

Generally GridView is used to show data in tabular format. It also provide ways to modify and delete records but currently there is no way to insert record using GridView. In this article, I shall describe an easy work around to insert record using GridView.

22. Updating, Deleting records using GridView control

In this article, I am going to explain how to manipulate data using GridView control. This article scope is limited to Updating and Deleting records using GridView and I am not using any readymade Data controls for that but manually writing all event methods. I will be using Sql objects directly into methods to keep the example simple and straight forward. In practical scenario you should use your existing architecture to populate and update the data.

Hope all above articles would be of great use to all of you. In case you face any other type of problems related with GridView that is not covered here, please respond to this article and I shall try to solve and publish.

Keep reading my forth coming articles. To read my series of articles on ASP.NET,click here.

Page copy protected against web site content infringement by Copyscape

About the Author

SheoNarayan
Full Name: Sheo Narayan
Member Level: HonoraryPlatinum
Member Status: Administrator
Member Since: 7/8/2008 6:32:14 PM
Country: India
Regards, Sheo Narayan http://www.dotnetfunda.com
http://www.snarayan.com
Ex-Microsoft MVP, Author, Writer, Mentor & architecting applications since year 2001. Connect me on http://www.facebook.com/sheo.narayan | https://twitter.com/sheonarayan | http://www.linkedin.com/in/sheonarayan

Login to vote for this post.

Comments or Responses

Login to post response

Comment using Facebook(Author doesn't get notification)