Click to See Complete Forum and Search --> : refresh or expires in ASP.NET??


dcolombo
07-26-2005, 12:32 AM
I have a datagrid in a form with the data all displaying and working fine. If I use a link column and go process a SQL command in another aspx file and redirect back to my form with the datagrid, the data is not updated with the results of the processed SQL statement. If I click the refresh the data is correct. I am assuming I need a DataBind() somewhere, but this is not really in a post back is it? Since we are actually shift all control to another file and then coming back, right? In classic asp I used Response.Expires=0 to make sure that the page is loaded each time, but that does not get the DataBind to occur either, any help would be appreciated.

DC

Phil Weber
07-26-2005, 12:44 AM
Do you have an "if (!IsPostBack)..." in your Page_Load method? If so, try commenting it out; you'll need to rebind the datagrid on every page load, not only on postback.

oupoi
07-26-2005, 02:45 AM
I think you need a 'DataAdapter.Fill' method rather than 'DataBind()'.
If there is no 'DataBind()', there should be NO record rather than old records.

Probably, the data in DataSet/DataTable are outdated. Execute 'DataAdapter.Fill' in appropriate position may solve the problem. :WAVE:

dcolombo
07-27-2005, 10:36 AM
I made sure that I am not checking IsPostBack, and I open the data connection and fill my OleDbDataReader each time (at least that is how I am reading the code). Then I set the datagrid source to the reader and databind. This occurs on every page load. I do get other things on the page reloaded, but the datagrid does not get updated unless I do a "reload/refresh" on the page.