Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

asp.net Updating label or textbox text at runtime

Status
Not open for further replies.

JScannell

Programmer
Jan 9, 2001
306
0
0
US
I've been struggling with this for quite a while. I've looked at several developers' forums but no one can provide what to do.

I have an ASP.NET website written in VB
I have a "Create file" button on the page.
When the button is clicked and right before the click event starts to do its thing, I want to update a TextBox with the start time of the run and clear out the StopTime and ElapsedTime text boxes.
Fortunately, I don't have an issue with updating any textboxes once the file is created, but I can't seem to update the initial values so the user sees it right away.

It's almost like I need some kind of entity that will work immediately, but for the life of me I can't figure it out. All the examples I see make use of an UpdatePanel and UpdateProgress code set that will make an image visible during the file creation. I've added that to my page so at least the user knows that something is happening and that he did click the button. Now if I could only populate the textboxes.

Thanks in advance,
Jerruy

Jerry Scannell
 

Even though you are using the Updatepanel, you'll have to use javascript to update the text box at the client prior to the post back using the PageRequestManager. You can update the textbox from the code-behind, but you will be setting it to the server time rather than the client time, which depending on your situation, may differ greatly.

Code:
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_initializeRequest(InitializeRequest);
prm.add_endRequest(EndRequest);
function InitializeRequest(sender, args) 
  {
    // update textbook with current time
  }
function EndRequest(sender, args) 
  {
    // update textbook with current time
  }


Mark

"You guys pair up in groups of three, then line up in a circle."
- Bill Peterson, a Florida State football coach
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top