Why is there a need to explicitly call GridView.DataBind() to render the gridview. Why wouldn’t it render by itself automatically like how it happens in Window Forms?
Why is there a need to explicitly call GridView.DataBind() to render the gridview. Why
Share
The simple reason is that the ASP.NET sites are stateless.
In Windows Forms your collection can be kept in memory, in ASP.NET that is not the case. The collection has to be rebuilt from post back to post back.
The GridView is different than the web on how it handles deletes, edits, which cannot directly modify the collection and save it down to the database. Typically the developer must do that work rather than relying on it to be done automatically.