Johan Hjalmarsson
Johan Hjalmarsson

Reputation: 3493

Refresh gridview with new databind

I need to refresh a div containing a gridview. I've seen alot of people suggesting the use of this:

$('#myDiv').html("SomeNewcontent");

But my bet is that it wont work with a sourcecode for ASP gridview. Is there some other way of refreshing JUST THAT DIV so that a new DataBind occurs?

Upvotes: 0

Views: 1183

Answers (1)

Hassan Mokdad
Hassan Mokdad

Reputation: 5902

To auto refresh a grid view, you can do it in two ways, both of them has nothing to do with the div

First way to to place it inside an update panel, and set the update panel to refresh at a specific interval in time: How to refresh an UpdatePanel control at a timed interval

Second Way is to use jquery and ajax and update only specific rows. In this case no data binding will occur, it is more efficient and faster than the first way, but you will need to redesign your database and workflow so that you can always get the latest data that changed. This will suit you better if you have a real time system

Upvotes: 1

Related Questions