decoleur
asked on
Auto refresh of a dynamically generated page in ASP that is tied to MS SQL
We are trying to build an app that lets a user select one of a series of real time reports using a drop down that refreshes the page to show a table with the real time values for that report. The challenge is that we are trying to make the results page refresh every 5 seconds and all attempts to do this cause the whole page to refresh without the selection made.
any suggestions would be appreciated, this was supposed to have been done yesterday.
thanks in advance,
-t
any suggestions would be appreciated, this was supposed to have been done yesterday.
thanks in advance,
-t
use an ajax script
I use an included opensource javascript framework called prototype that has some nice shortcuts.
Right now I'm working on a new site: http://portfsa.org/tools/calculator.aspx
That page has a calculator on it. When the user leaves a field, it actually sends a call to the server, gets the updated calculation and places the result in the subtotal box. (not some javascript calculator script working client-side)
calls this script:
function morris_ajax_v_1_0(params,i d) {
// var params = "test=1"
var url = "/ajax/calculator.asp"
new Ajax.Request(url, {
method: 'get',
parameters: params,
onSuccess: function(transport) {
// var data = transport.responseText.eva lJSON()
// $('total_current_cash_need s').innerH TML = data.total_current_cash_ne eds;
setvals(transport.response Text, id)
}
});
}
which returns simple JSON that is generated with asp using variables that are adjusted by the client in their database.
{'total_current_cash_needs ':'$0.00', 'total_cash_for_monthly_in come':'$0. 00', 'total_cash_reserve_requir ed':'$0.00 ', 'total_assets':'$0.00', 'total_life_insurance_need ed':'$0.00 ', 'total_current_and_long_te rm_cash_ne eds':'$0.0 0' }
Feel free to rip out whatever you'd like if you're interested :)
Right now I'm working on a new site: http://portfsa.org/tools/calculator.aspx
That page has a calculator on it. When the user leaves a field, it actually sends a call to the server, gets the updated calculation and places the result in the subtotal box. (not some javascript calculator script working client-side)
calls this script:
function morris_ajax_v_1_0(params,i
// var params = "test=1"
var url = "/ajax/calculator.asp"
new Ajax.Request(url, {
method: 'get',
parameters: params,
onSuccess: function(transport) {
// var data = transport.responseText.eva
// $('total_current_cash_need
setvals(transport.response
}
});
}
which returns simple JSON that is generated with asp using variables that are adjusted by the client in their database.
{'total_current_cash_needs
Feel free to rip out whatever you'd like if you're interested :)
ASKER
can you please elaborate? we are using visual studio c# and asp, how would we incorporate ajax?
I am not adverse to it but do not know what is entailed.
Can you provide more info on this?
I am not adverse to it but do not know what is entailed.
Can you provide more info on this?
here is how you can trigger that update with a timer:
http://www.elated.com/articles/javascript-timers-with-settimeout-and-setinterval/
There's a lot of other options.
http://www.elated.com/articles/javascript-timers-with-settimeout-and-setinterval/
There's a lot of other options.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Danielcmorris-
This is a nice interface but this is requiring the user to do something. Our user says they want to look at the pork futures page and then every five seconds we want to update the values for the different columns. Our problem is that the refreshing page is post selection. could you provide any pointers for that?
Thanks in Advance!
-t
This is a nice interface but this is requiring the user to do something. Our user says they want to look at the pork futures page and then every five seconds we want to update the values for the different columns. Our problem is that the refreshing page is post selection. could you provide any pointers for that?
Thanks in Advance!
-t
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://www.asp.net/learn/ajax-videos/video-99.aspx works too.
It may be best to stick with PCableGuy's solution if you intend to have this project run by someone else.
Basically, don't do a bunch of custom code that some new employee might stumble on. With the ajax toolkit, you can simply ask the new employee, "so, do you know how to use an updatepanel and timer?"
It may be best to stick with PCableGuy's solution if you intend to have this project run by someone else.
Basically, don't do a bunch of custom code that some new employee might stumble on. With the ajax toolkit, you can simply ask the new employee, "so, do you know how to use an updatepanel and timer?"
ASKER
Thanks for the input, updatepanel and timer seems like the way to go.