Abdul Qayyum
Abdul Qayyum

Reputation: 1052

Want to keep data on asp.net page

I'm working on page and want to refresh it after short interval. after each one minute the page should be refresh. the code i'm using is

<meta http-equiv="refresh" content="60000">

it is working fine, refreshing page after every 1 minute. when this page is called it loads a datatable. i want to keep datatable in a variable after first attempt and want to use it for further 4 attempts. i have used ViewState but it didn't worked. i do not want to use session as well.is there any other options ?

Upvotes: 0

Views: 182

Answers (3)

Abdul Qayyum
Abdul Qayyum

Reputation: 1052

i have figured it out by changing scenario.I have added a class i.e remainingtime with each <td class="remainingtime"> for that specific column.

 <script>
    var refreshId = setInterval(function () {
        $("td.remainingtime").each(function () {
            var current = parseInt($(this).text());
            current = current - 5;
            $(this).text(current);
        });
    }, 6000);
</script>

it fulfills my requirement. thank you guys for your contributions.

Upvotes: 0

KarthikManoharan
KarthikManoharan

Reputation: 805

try this one,

 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="foo.aspx.cs" Inherits="WebApplication4.DemoPages.foo" 
 ViewStateMode="Enabled" %>

Upvotes: 0

शेखर
शेखर

Reputation: 17614

ViewState can't be used in your situation because it is not posting to the same page. It's a new request for the same page.

As far I know you need to keep it in session. Other wise use Page caching Technique.

<%@ OutputCache duration="10" varybyparam="None" %> 

Add it below page directive it will cache the page. But the problem is it will be same for all the users

More detail about caching
http://msdn.microsoft.com/en-us/library/vstudio/06bh14hk(v=vs.100).aspx

Upvotes: 1

Related Questions