Attilah
Attilah

Reputation: 17930

Gridview inside UpdatePanel refresh

I use a GridView to represent data from a table in my DB.

the GridView has some template fields whose content are determined before displaying the Grid ( I use the RowDataBound event to determine content of template fields before displaying the GridView).

The page displays a list of records from the table records and then, the recording process starts. after the process is over, the template fields should be updated.

how do I automatically refresh the GridView after the process is finished ? it should be noted that the GridView is contained within an control and that I continuously poll the server using a Timer control that executes "GridView1.DataBind()" at the server level every 60 seconds.

since the GridView is inside an UpdatePanel, calling DataBind() method on it doesn't seem to call the RowDataBound event.

How can I solve this ?

Upvotes: 0

Views: 1329

Answers (1)

solairaja
solairaja

Reputation: 964

Yes, thats enough to call the GridView1.DataBind() Method in a particular time interval lapses using the Timer control, but before calling the DataBind() method, have you assigned the updated data source for the Gridview ? For eg; When the page loads you are drawing the gridview using a Dataset named "EmployeeDS". so after some update, you need to update the local dataset like below to the gridview, then call the DataBind() method.

GridView1.DataSource = EmployeeDS.Table[0];
GridView1.DataBind();

Upvotes: 1

Related Questions