ASP.NET refresh the data every 15 sec and retain the values already populated in the page

ASP.NET
I am using    <meta http-equiv="refresh" content="300">
for refreshing the auto refreshing the page in ASP.NET
, however the values of the list and text box get lost when i do this.

i tried using enableviewstate but still the values are not retained.
is there any way i can auto refresh the data of a page after every 15 sec and retain the values already populated in the page
kurtcobain123Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
How are you binding the data in the Page_Load event?

Bob
0
kurtcobain123Author Commented:
i call a function for binding the data

rdDisplay_SelectedIndexChanged(null,System.EventArgs.Empty);


which has all the dataloading functions... based on selection of the radiobutton.
the problem is that this selection gets lost if i use the meta tag

AB
0
Bob LearnedCommented:
When the refresh occurs, the page is reloaded.  Can you show me the rdDisplay_SelectedIndexChanged code, and the Page_Load, please?

Bob
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

kurtcobain123Author Commented:
here u go .....
#region Page_Load
            private void Page_Load(object sender, System.EventArgs e)
            {

                  if (!Page.IsPostBack)
                  {
                        rdDisplay.SelectedIndex = 0;
                  }

                  OracleConnection oConn = new OracleConnection(System.Configuration.ConfigurationSettings.AppSettings["dbConnection"]);
                  oConn.Open();
                  OracleCommand cmd = oConn.CreateCommand();
                  string SQLString =  " select to_char(sysdate,'dd Mon yy hh24:mi:ss') as dt from dual " ;
                  OracleCommand oCmd = new OracleCommand(SQLString, oConn);
                  
                  DataSet ds = new DataSet();
                  OracleDataAdapter adapter = new OracleDataAdapter(oCmd);
                  adapter.Fill(ds);
                  LblRefreshdate.Text = ds.Tables[0].Rows[0].ItemArray[0].ToString();
                  oConn.Close();
                  rdDisplay_SelectedIndexChanged(null,System.EventArgs.Empty);


            }
            #endregion

#region rdDisplay_SelectedIndexChanged
            private void rdDisplay_SelectedIndexChanged(object sender, System.EventArgs e)
            {
                  if(rdDisplay.SelectedIndex == 0)  //all
                  {
                        btnShow.Visible = false;
                        ScheduleGeneral1.FullTimeScale = false;
                        txtTimeInterval.Visible = false;
                        lblTimeInterval.Visible = false;
                        txtTimeInterval.Text = "60";
                        BindData();
                  }
}
            #endregion

Thanks
0
Bob LearnedCommented:
Troubleshooting check:

1) Can you put breakpoints when running?

2) Put a breakpoint in the Page_Load, and check the value of the controls to see if they are what you expect before anything else is done.  My guess is that they are fine, and something else later is messing it up

3) I create a small test with a single control, and a meta refresh, and after the post-back the state of the control was kept.

Bob
0
kurtcobain123Author Commented:
I tried but am loosing the viewstate info i think this is because the meta refresh doesn't cause a postback. Rather,it's a completely new page request.

neideas how to do this using javascript timer fn ?
0
Bob LearnedCommented:
</body>

<script language='Javascript'>
setTimeout(Refresh, 15000);

function Refresh()
{
  __doPostBack('Dummy', '');
}
</script>

Bob
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kurtcobain123Author Commented:
Found a solution....

setTimeout("Form1.submit()",30000);

works !

0
kurtcobain123Author Commented:
Thanks Bob
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.