No, you have to put the GridView Bind function inside the
!IsPostBack
, otherwise there will be many problems including the problem you have specified.
This is because, before every event fires, it will go to page load first. And if you are binding the GridView on PageLoad, then it will be newly loaded again.
So, when the event will be fired after that, it will show the old values as the Grid is already loaded with old values.
So, put your code in
!IsPostBack
.
Now as per your requirement, you need to refresh the Grid sometimes.
For that, just call the Bind function inside the event or function you want to bind it. Like below.
protected void Button1_Click(Object sender, EventArgs e)
{
BindGrid();
}