Hi,
I have an ASP .NET page, that runs client side timer that
does something on the Server side and after that loads
another page. So I have on client side something like :
function OnPageLoad()
{
setTimeout("OnTimer()", 10000);
}
function OnTimer()
{
ServerMethod();
}
<body onload="OnPageLoad()">
<form id="Form1" method="post" runat="server">
It does not work, and I understand why - client side does
not know what is ServerMethod();
How to call server side method from the timer callback ?
Meanwhile I found workaround : created in Form1 tiny
disabled button DummyBtn "runat=server", defined such
server-side event handler for click :
void DummyBtn_ServerClick(object obj,EventArgs e)
{
ServerMethod();
}
and on the client side in OnTimer method wrote
Form1.DummyBtn.click();
So the timer simulates click of DummyBtn, click runs its
event handler, the event handler in turn calls the server
method.
It works, but it is ugly solution. I 'd like to call
ServerMethod() from the timer callback directly, without
tricks like this. Is it possible ? 3 6846
You can use the web service behavior for this. (WebService.htc)
This technique works with IE only.
Here's more details: http://msdn.microsoft.com/library/de...s/overview.asp http://msdn.microsoft.com/downloads/...ce/default.asp
--
I hope this helps,
Steve C. Orr, MCSD, MVP http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com
"Borr" <an*******@discussions.microsoft.com> wrote in message
news:05****************************@phx.gbl... Hi,
I have an ASP .NET page, that runs client side timer that does something on the Server side and after that loads another page. So I have on client side something like :
function OnPageLoad() { setTimeout("OnTimer()", 10000); }
function OnTimer() { ServerMethod(); }
<body onload="OnPageLoad()"> <form id="Form1" method="post" runat="server">
It does not work, and I understand why - client side does not know what is ServerMethod();
How to call server side method from the timer callback ? Meanwhile I found workaround : created in Form1 tiny disabled button DummyBtn "runat=server", defined such server-side event handler for click :
void DummyBtn_ServerClick(object obj,EventArgs e) { ServerMethod(); }
and on the client side in OnTimer method wrote
Form1.DummyBtn.click();
So the timer simulates click of DummyBtn, click runs its event handler, the event handler in turn calls the server method.
It works, but it is ugly solution. I 'd like to call ServerMethod() from the timer callback directly, without tricks like this. Is it possible ?
there is no direct live connection between the client side and server side,
because HTTP is a stateless connetion type.
Unlesss you use something like ActiveX, or Java applet, the only way you can
communicate between the client and server sides are doing the form posting.
Alone this line, you can call form.submit() method in your timer method and
activate the server side methods.
Jianjun
"Borr" <an*******@discussions.microsoft.com> wrote in message
news:05****************************@phx.gbl... Hi,
I have an ASP .NET page, that runs client side timer that does something on the Server side and after that loads another page. So I have on client side something like :
function OnPageLoad() { setTimeout("OnTimer()", 10000); }
function OnTimer() { ServerMethod(); }
<body onload="OnPageLoad()"> <form id="Form1" method="post" runat="server">
It does not work, and I understand why - client side does not know what is ServerMethod();
How to call server side method from the timer callback ? Meanwhile I found workaround : created in Form1 tiny disabled button DummyBtn "runat=server", defined such server-side event handler for click :
void DummyBtn_ServerClick(object obj,EventArgs e) { ServerMethod(); }
and on the client side in OnTimer method wrote
Form1.DummyBtn.click();
So the timer simulates click of DummyBtn, click runs its event handler, the event handler in turn calls the server method.
It works, but it is ugly solution. I 'd like to call ServerMethod() from the timer callback directly, without tricks like this. Is it possible ?
That's not entirely true, you can use server side blocks to execute methods
on the server-side although it is a somewhat advanced technique.
--
-----------
Got TidBits?
Get it here: www.networkip.net/tidbits
"Jj" <ji*******@yahoo.com> wrote in message
news:q9********************@comcast.com... there is no direct live connection between the client side and server
side, because HTTP is a stateless connetion type.
Unlesss you use something like ActiveX, or Java applet, the only way you
can communicate between the client and server sides are doing the form
posting. Alone this line, you can call form.submit() method in your timer method
and activate the server side methods.
Jianjun
"Borr" <an*******@discussions.microsoft.com> wrote in message news:05****************************@phx.gbl... Hi,
I have an ASP .NET page, that runs client side timer that does something on the Server side and after that loads another page. So I have on client side something like :
function OnPageLoad() { setTimeout("OnTimer()", 10000); }
function OnTimer() { ServerMethod(); }
<body onload="OnPageLoad()"> <form id="Form1" method="post" runat="server">
It does not work, and I understand why - client side does not know what is ServerMethod();
How to call server side method from the timer callback ? Meanwhile I found workaround : created in Form1 tiny disabled button DummyBtn "runat=server", defined such server-side event handler for click :
void DummyBtn_ServerClick(object obj,EventArgs e) { ServerMethod(); }
and on the client side in OnTimer method wrote
Form1.DummyBtn.click();
So the timer simulates click of DummyBtn, click runs its event handler, the event handler in turn calls the server method.
It works, but it is ugly solution. I 'd like to call ServerMethod() from the timer callback directly, without tricks like this. Is it possible ?
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: HarveyB |
last post by:
I would like to generate non-modal popup windows from
ASP.Net code-behind. I have tried using Client Side
scripting like "function Test(){
window.open('test.htm',_blank,...
|
by: Randell D. |
last post by:
Folks,
I'm sure this can be done legally, and not thru tricks of the trade - I
hope someone can help.
I'm writing a 'tool' (a function) which can be used generically in any
of my projects. ...
|
by: Bonato Pierantonio |
last post by:
Hi All,
It is possible inside a SCRIPT tag in the HTML page to call a SUB or
FUNCTION write in the codebehind ?
Example in the HTML
<SCRIPT Language=vbscript>
sub mySub
call mySecondSub
end...
|
by: abcd |
last post by:
I am novice asp.net programmer.
I have xyz.js file which has resuable functions. I have asp.net form
abcd.aspx and the code behind file abcd.aspx.cs, I want to put a 'Help'
button when clicked...
|
by: Mr Bojangles |
last post by:
Hi,
I want a do the following:
From a (client side) web form, post to server side script (I'm using
Javascript but anything will do), which in turn--and this is the important
bit that I...
|
by: rgintexas |
last post by:
i'm trying to get server side vbscript to execute in firefox:
</script>
<script type="text/VBScript" src="VBFile.vbs">
</script>
is there any way i can use javascript to call the vbs file, or...
|
by: Werner Willemsens |
last post by:
Hi,
I have the following situation. COM server exposed on Windows CE 5.0 through
SOAP (SOAP toolkit)
C# client on XP calls Web Service methods on CE (COM)SOAP server.
The complete call takes...
|
by: Ryan Liu |
last post by:
Hi,
I have a 100 clients/ one server application, use ugly one thread pre client
approach. And both side user sync I/O.
I frequently see the error on server side(client side code is same, but...
|
by: Simon |
last post by:
I heard that we could do that by using AJAX. Could anybody share how to do
it? Thanks.
|
by: Kemmylinns12 |
last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
|
by: Naresh1 |
last post by:
What is WebLogic Admin Training?
WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
|
by: antdb |
last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine
In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
|
by: Matthew3360 |
last post by:
Hi,
I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
|
by: BLUEPANDA |
last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
|
by: Rahul1995seven |
last post by:
Introduction:
In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
|
by: Ricardo de Mila |
last post by:
Dear people, good afternoon...
I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control.
Than I need to discover what...
|
by: Johno34 |
last post by:
I have this click event on my form. It speaks to a Datasheet Subform
Private Sub Command260_Click()
Dim r As DAO.Recordset
Set r = Form_frmABCD.Form.RecordsetClone
r.MoveFirst
Do
If...
|
by: jack2019x |
last post by:
hello, Is there code or static lib for hook swapchain present?
I wanna hook dxgi swapchain present for dx11 and dx9.
| |