i need help --can i call function written on server side insid (run at server) inside function written on clinet side

hi every one.
i am using java script to call  setTimeout() function
and i want to call myfunction () inside setTimeout()


setTimeout(myfunction(); time)
but the myfuction() is written in Codebehind

please i want to know if i can do that if it is possible, how i can do that
0 ishaika 9/9/2005 4:10:47 PM

This might work:


setTimeout("timedFunction()", time)

function timedFunction()
{
 __doPostBack('TimerFunction', '');
}

// CodeBehind Page_Load event handler
private void Page_Load(object sender, System.EventArgs e)
{
 // Insure that the JavaScript __doPostBack method is added...
 this.GetPostBackEventReference(this, "PBArg");

 if ( this.IsPostBack )
 {
  object eventTarget = this.Request["__EVENTTARGET"];

  if ( (eventTarget != null) &&
   (eventTarget.ToString() == "TimerFunction") )
  {
   // Call your CodeBehind method
   myfunction();
  }
 }
}

NC...

0 NC01 9/9/2005 5:37:16 PM
JavaScript and the server are two seperate things that can not talk like that. You can use the __doPostBack(eventTarget, eventArgument) to trigger a post back to the server so you can execute that code on the server.

Eric
Pascarello.com | Twitter epascarello | LinkedIn
0 A1ien51 9/9/2005 5:45:55 PM
Mr  NC01  thank you very much for helping
i tried your code , it is working


0 ishaika 9/9/2005 7:32:24 PM
I hope I can get help for something as follows:
A method in a form pop up a window in javascript to prompt for user input. Basically the code is Response.Write("open.window..."). The window opens another webform that does some data processing thru the user prompt then closes itself with Response.Write("window.close();"). At this point will the focus land back to the calling form and the remaining code in its method continue to execute? Upon testing my code, I have the impression that the whole thing hangs there and nothing else happens. Can someone give me some light on that? Thanks much.
Please mark the post(s) that have helped you as "Answer"
0 thuhue 10/14/2005 12:22:22 AM
Reply:

(Thread closed)