Updating gridview checkbox

Posted by / 06-Aug-2020 02:39

Updating gridview checkbox

To provide user option to update the status of any Category from the Check Box I am also setting Auto Post Back Property to true and adding Event Handler chk Status_On Checked Changed to handle On Checked Changed event.Every time user will check or uncheck the Check Box this event will update the status of Approved Column in the Database.The Page Load event binds your Database Categories Table to your Grid View Control.Please keep in mind that I put connection string directly in the code just for the demonstration.

I figured out this problem is caused by the Checkbox field .In the above code see how I am setting Checked State of the Check Box from the Approved Column value in the database.I am also setting the Text Property of the Check Box Approved or Not Approved according to the state of Approved Column in database.One Typical example is to Enable/Disable status of any record in the database table using the Check Box in the Grid View.In the following tutorial I will show you how you can use Check Box in the Grid View which not only display the current status of the record but also update the record status in the database.

updating gridview checkbox-14updating gridview checkbox-50updating gridview checkbox-59

I took your Grid View, created an Object Data Source that matched the Fields that the Grid View was displaying and bound the Grid View to it so that I can see what you're "seeing".