473,413 Members | 2,051 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

Calling ASP.NET server side subroutine from javascript

Hi, I have a timer in javascript on my ASP.NET page. When the time
expires (a point in my javascript code) I want to call a subroutine
in my ASP.NET page. But I can't seem to figure out how to do this.

My subroutine is actually a function I call as a result of a button
click. But if the user doesn't click the button in the allotted time,
I want to go ahead and call the function anyways.

Any idea how I can do this?

Thanks.

Asad

Nov 18 '05 #1
2 1536
use the __doPostBack('MyButton', '') javascript function. MyButton is, say,
an <asp:linkbutton> (definitely works) but I think it can be anything.
If you look at the html source generated when you run an aspx page you will
find that this is what asp.net server controls do anyway.
You can use
document.forms['Form1'].item('postbackparams').value = arg
where postbackparams is, say, an <input type="hidden" id="postbackparams">
to set parameters.

"asadikhan" <as*******@hotmail-dot-com.no-spam.invalid> wrote in message
news:40**********@127.0.0.1...
Hi, I have a timer in javascript on my ASP.NET page. When the time
expires (a point in my javascript code) I want to call a subroutine
in my ASP.NET page. But I can't seem to figure out how to do this.

My subroutine is actually a function I call as a result of a button
click. But if the user doesn't click the button in the allotted time,
I want to go ahead and call the function anyways.

Any idea how I can do this?

Thanks.

Asad

Nov 18 '05 #2
Hi

A simple approach can be to 'refresh' the page when its 'TimeOut' - specify yo Time-Out period in the parameter 'Refresh' of the meta content on top of the page and set its 'content' to say 5 (5 seconds) - this will refresh yo page every 5 seconds ..

Now on the server side all yo've to do is check fo yo condition(i.e a value in text-box) in 'Page_Load' and call event if its true !!

Tell me if this doesn't work (Sa*********@hotmail.com)
Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: R.G. Vervoort | last post by:
I am using a javafunction (onclick in select) in which i am calling a function in php (thats why i send this to both php and javascript newsgroups). in the onclick i call the function...
5
by: Krishna | last post by:
Hi all, Can i call my javascript functions from the web controls.Any appropriate site which will be tell more on this will be helpfull. Regards.., Krishna
1
by: C | last post by:
Hi, I have a server side asp.net button on a web page. On clicking the button I want to call some Javascript. Can I not simply do a onclick="MyJavascript();" or is it necessary that I add...
3
by: ~J~ | last post by:
Hi everyone I'm positive this is possible, just never needed it until now and I don't have a clue where to start I have an XML document that is attached to an XSL style sheet, within this XSL...
7
by: Roger | last post by:
Is this possible?? client side: <script language="jscript"> function hello() { window.alert("HELLO!"); } </script>
9
by: misdst23 | last post by:
Hi, I know I can call a static java method within javascript by using the <% ... %tags. But how can pass a javascript variable ? function thefunction() { var = javascriptvariable ;
2
by: victor.buga | last post by:
Hi, Could somebody please guide me how to retrieve the subroutine that's on the server, and using javascript tell the server to invoke that subroutine. Everything is in the same ".asp" page. ...
6
by: teddysnips | last post by:
In my application I need to allow users to cut 'n' paste stuff from various sources, some of which might include dodgy characters such as "<". Natch, IE interprets these as potentially dangerous...
0
by: ninjastar85 | last post by:
Hi, I'm trying to call a vbscript subroutine from my c# codebehind using RegisterStartupScript but for some reason it wont work.. I have this in my c#-codebehind...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.