Showing posts with label instant. Show all posts
Showing posts with label instant. Show all posts

Monday, March 26, 2012

Instant GridView Refresh on Update Button Click

I have an application that allows for the updating of data in an Oracle table. I am using Atlas, with ObjectDataSources.

There is a quicklist gridview displaying the data, the user picks the record and it displays some options for updating the record in a seperate form on the page.

Upon clicking the update button the record is updated and a Verify changes button is displayed. When the user clicks the Verify changes button the page will display the correct update.

I have found no other way to to display the change on the Update button click.

Is there a way to instantly show the update with only one click of a button. I want the gridview to rebind and display the new update with the update button click. Why does it take two clicks to show the update?

are you using Gridview1.Databind() when you click update?

That forces an update no matter what.

Instant Update Panel

I have a page on my site that displays one image, the user can post a comment about the image and rate it from 1-5 using the ajax rating control. The page entire page postbacks when the user posts a comment about the image. I am trying to get the comments gridview to postback on its own. The rating control and comment text box and gridview of comments is in a usercontrol. I put it on my photo.aspx page and then put it in an updatepanel. The user now can add a comment (and it does add) but the page still needs to be reloaded how to do you it to instantly update for new comments? Ive seen this on facebook if anyone is wondering where the influence for trying to do this is, can anyone recomend how to do this? thanks in advance ! si!

Throw your code here and let me see..


it took about an hour but it makes sense now! after the comment has been posted, I get it to reset the gridviews datasource and then databind it! haha, thanks thoughBig Smile si!

instant update from database in aspx page using AJAX

Hi

Can someone point me in the right direction? I have a simple admin screen on my website which shows a tables values from my mssql database. How ever, rather than refreshing every 30 seconds to check for new entries, is there a way using AJAX which instantly updates the admin screen as soon as a new entry is inserted into the database?

thanks

There's not a way for the server to communicate directly with the client, unless the client requests it. The way functionality like what you want is implemented is to continually ping a light weight service that returns information about the last update to the underlying data.

For example, a JSON Web Method that returns the timestamp of the most recent item, which you can compare with the timestamp of the most recent refresh you did. If it's newer than your last update, then you can call a heavier method to update the table.

You can use window.setInterval() in JavaScript to set up the periodic check.


You really have no choice but to set a timer and check the database at a set interval, unless you want to get outside the realm of AJAX and DHTML.

All web based communication is initiated by the client. The only way to have server initiated communication is through an application, such as an AcitveX Object. There are a few (a very few) websites which address this topic but because it is so much more difficult, invasive to the end-users computer, and platform/browser specific, it is rare to find this type of setup.


thanks for your replies, very interesting. I guess the timer option is the way i will have to go. I wish to make the 'service' as light as possible, and the timestamp seems ideal - do you know of any examples, or have any tips on making this as optimal and least processor intensive as possible?

thanks again


You could basically combine these two posts from my blog, with setInterval, to do it:

http://encosia.com/index.php/2007/07/11/why-aspnet-ajax-updatepanels-are-dangerous/

http://encosia.com/index.php/2007/07/13/easily-refresh-an-updatepanel-using-javascript/


thanks gt, great posts - just had a quick browse of the rest of your site, you've got some excellent content on there!!

cheers Yes


I decided to put a simple example together, if anyone else is interested: http://encosia.com/index.php/2007/07/25/display-data-updates-in-real-time-with-ajax/