---
title: "How to use Linkbutton in Gridview using C#"  
description: "How to use Linkbutton in Gridview using C#"  
author: "Madam Walker"  
published: 2013-10-05  
updated: 2013-10-05  
canonical: https://www.mindstick.com/forum/1613/how-to-use-linkbutton-in-gridview-using-c-sharp  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# How to use Linkbutton in Gridview using C#

When I [click](https://www.mindstick.com/articles/12423/social-login-magento-2-one-click-to-register-social) the one of the [command](https://www.mindstick.com/blog/178/synchronous-and-asynchronous-command-execution-in-c-sharp-dot-net) [source](https://www.mindstick.com/interview/840/what-happens-if-the-both-source-and-destination-are-named-same) , like [name](https://yourviews.mindstick.com/view/87450/how-to-generate-a-brand-name-using-linkedin-comprehensive-guide).. it changes the bgcolor for that name , but I also want to click one more time on same name to to [disable](https://www.mindstick.com/forum/12901/how-to-disable-enable-input-box-in-aspx-with-value-from-sql) bg color..\

How can i achieve this?

Thanks in [advanced](https://www.mindstick.com/articles/12993/5-advanced-features-for-your-odoo-ecommerce-theme)!

## Replies

### Reply by Anonymous User

Maintain a hidden variable near to that button and set the value of that as "0" by default. Every time you click on the adjacent button, Increase the value of this hidden variable. Now in the click event you can check the current value and decide whether you want to change the background color to Blue or Re or whatever color you want


---

Original Source: https://www.mindstick.com/forum/1613/how-to-use-linkbutton-in-gridview-using-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
