Solved

Refresh page ASP.NET C#

Posted on 2016-09-22
3
108 Views
Last Modified: 2016-09-22
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?
0
Comment
Question by:Alex E.
  • 2
3 Comments
 
LVL 21

Expert Comment

by:Randy Poole
ID: 41811432
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

0
 

Author Comment

by:Alex E.
ID: 41811471
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?
0
 
LVL 21

Accepted Solution

by:
Randy Poole earned 500 total points
ID: 41811485
Try replacing what I gave you with:
Response.Redirect(Request.RawUrl);

Open in new window

1

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question