user32848
user32848

Reputation: 249

Refresh a webpage automatically from within a loop

I have a loop that runs through a variety of websites and I'd like to put some kind of a postback in the loop so that each time through a textbox would refresh with the url that is currently being considered. I don't know AJAX yet so I'd like to redo the webpage. I am currently using a session variable to hold data for display between page loads. I have tried

1) Response.Redirect("Default.aspx");

2) Server.Transfer("Default.aspx");

3) Page_Load(sender, e);

4) this.RaisePostBackEvent(URLTextBox.Text);

but they don't work, possibly because I am not implementing them properly. I'd like to watch the current situation as it is updated within the loop. Any ideas? Thanks, bsperlin

Upvotes: 0

Views: 1508

Answers (1)

Asad
Asad

Reputation: 21918

It works but is not a recommended approach

Put your text box inside an updatepanel linked with a timer control and bind text box to a class variable, which is updated every time a new url is considered. You can update textbox in Timer_Tick event .

Timer_Tick
{ 
  UrlTextBox.Text = urlconsidered; 
}

have a look at this tutorial

Upvotes: 1

Related Questions