kurtcobain123
asked on
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
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
ASKER
i call a function for binding the data
rdDisplay_SelectedIndexCha nged(null, System.Eve ntArgs.Emp ty);
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
rdDisplay_SelectedIndexCha
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
When the refresh occurs, the page is reloaded. Can you show me the rdDisplay_SelectedIndexCha nged code, and the Page_Load, please?
Bob
Bob
ASKER
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.Co nfiguratio n.Configur ationSetti ngs.AppSet tings["dbC onnection" ]);
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].ItemA rray[0].To String();
oConn.Close();
rdDisplay_SelectedIndexCha nged(null, System.Eve ntArgs.Emp ty);
}
#endregion
#region rdDisplay_SelectedIndexCha nged
private void rdDisplay_SelectedIndexCha nged(objec t sender, System.EventArgs e)
{
if(rdDisplay.SelectedIndex == 0) //all
{
btnShow.Visible = false;
ScheduleGeneral1.FullTimeS cale = false;
txtTimeInterval.Visible = false;
lblTimeInterval.Visible = false;
txtTimeInterval.Text = "60";
BindData();
}
}
#endregion
Thanks
#region Page_Load
private void Page_Load(object sender, System.EventArgs e)
{
if (!Page.IsPostBack)
{
rdDisplay.SelectedIndex = 0;
}
OracleConnection oConn = new OracleConnection(System.Co
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].ItemA
oConn.Close();
rdDisplay_SelectedIndexCha
}
#endregion
#region rdDisplay_SelectedIndexCha
private void rdDisplay_SelectedIndexCha
{
if(rdDisplay.SelectedIndex
{
btnShow.Visible = false;
ScheduleGeneral1.FullTimeS
txtTimeInterval.Visible = false;
lblTimeInterval.Visible = false;
txtTimeInterval.Text = "60";
BindData();
}
}
#endregion
Thanks
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
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
ASKER
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 ?
neideas how to do this using javascript timer fn ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Found a solution....
setTimeout("Form1.submit() ",30000);
works !
setTimeout("Form1.submit()
works !
ASKER
Thanks Bob
Bob