开发者

Refresh a webpage automatically from within a loop

开发者 https://www.devze.com 2022-12-21 23:28 出处:网络
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 bein开发

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 bein开发者_开发问答g 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


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

  • Introduction to the UpdatePanel Control
0

精彩评论

暂无评论...
验证码 换一张
取 消