Search code examples
c#asp.netgridviewdatabound

Gridview update a column using another column


I have a gridview bound with a database. I would like to add an extra column which has a linkbutton. The intention is that when clicked on the linkbutton, the user could toggle the value of a column which is bounded with the database.

I don't have any good ideas how to get started on this. Any help would be greatly appreciated!

Regards, Thijs


Solution

  • If I understand you question,

    Make you gridview template fields. you can find more about Using TemplateFields in the GridView Control

    Place the linkbutton with a commandname. See ButtonField.CommandName Property

    In here do the same for the field you need to access. You will be able to access the values and change as you need.

    Hope this helps