1

I have a gridview in ASP.nET and I have a "Select" command field. What I want to do is that when the user click on on the "select", I would like to take the selected row and do some calculations and rebind the original gridview with updated the row.

How can do this?

Thanks.

Tony
  • 3,319
  • 12
  • 56
  • 71
  • 1
    Call `GridView.DataBind()` again. – Rahul Jul 19 '11 at 18:34
  • Possible duplicate of [GridView not Rebinding Properly After Postback](https://stackoverflow.com/questions/1759325/gridview-not-rebinding-properly-after-postback) – Daniel B Dec 07 '17 at 21:47

2 Answers2

2
// do your thingy

DataGridViewName.DataBind();
rtp
  • 794
  • 1
  • 10
  • 26
1

There are a lot of places where grabbing the row is already explained. Take a look at this Link. You have to call the bind data method on the grid after your calculations. If you want to modify just that row, I would think you modify the source data collection for that row and rebind.

This link may also help. Instead of Edit, you could have Select.

coder net
  • 3,447
  • 5
  • 31
  • 40