Link to home
Start Free TrialLog in
Avatar of Alex E.
Alex E.

asked on

Refresh page ASP.NET C#

We have a webpage form in asp.net c# that write to a text file with File.ReadAllLines. Now we want to know after make the change how can we refresh the actual web page form? Because we have in the form text labels to update the change of ReadAllLines process but only work if you logout and login again or if you make refresh in the browser. Then we need to make refresh after make the change for the data update properly or at least execute that webpage form the first time and execute all since the page private load code behind. How can we do that?
Avatar of Randy Poole
Randy Poole
Flag of United States of America image

Assuming you have a scriptmanager on your page then do the following after you are done processing the submission:
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "redo", "location.reload(true);", true);

Open in new window

Avatar of Alex E.
Alex E.

ASKER

We have a button when the user clicks that button execute the File.ReadAllLines process and we entered at the end your command:

ScriptManager.RegisterStartupScript(Page, Page.GetType(), "redo", "location.reload(true);", true);

Open in new window


And makes refresh but in an endless loop there is no way to escape. All time is refreshing and you see the page refreshing but you can touch any button? Is there a way to use that command wihtout the endless loop?
ASKER CERTIFIED SOLUTION
Avatar of Randy Poole
Randy Poole
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial