Solved

Refresh page ASP.NET C#

Posted on 2016-09-22
3
63 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

708 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now