473,657 Members | 2,678 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Run Server-side Function *immediately after* executing client-side JavaScript.

Suppose I have a hyperlink that, when clicked, executes a JavaScript
function on the client. Separately I have a button that, when clicked,
causes a post back and executes a server-side function, as in the following:

<a id="HyperLink5 " href="javascrip t:DoSomethingIn Client()">Do Something</a>

<asp:Button id="btnSaveChan ges" EnableViewState ="true"
CommandName="Sa veChanges" Visible="true" Width="115" runat="server"
Text="Save Changes"></asp:Button>

What I want is to have it so that when the user clicks on the hyperlink, the
JavaScript function executes and then the PostBack gets initiated
immediately after the JavaScript function does its thing - as if the user
had clicked on the Save Changes button (but without requiring the user to
click on the button). That is, I want the JavaScript to make its client-side
changes and then cause the server-side "Save Changes" function to execute.
Any ideas?

Thanks!
Nov 18 '05 #1
4 3118
"Guadala Harry" <Ch*********@gh .com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Suppose I have a hyperlink that, when clicked, executes a JavaScript
function on the client. Separately I have a button that, when clicked,
causes a post back and executes a server-side function, as in the following:
<a id="HyperLink5 " href="javascrip t:DoSomethingIn Client()">Do Something</a>
<asp:Button id="btnSaveChan ges" EnableViewState ="true"
CommandName="Sa veChanges" Visible="true" Width="115" runat="server"
Text="Save Changes"></asp:Button>

What I want is to have it so that when the user clicks on the hyperlink, the JavaScript function executes and then the PostBack gets initiated
immediately after the JavaScript function does its thing - as if the user
had clicked on the Save Changes button (but without requiring the user to
click on the button). That is, I want the JavaScript to make its client-side changes and then cause the server-side "Save Changes" function to execute.
Any ideas?


Use btnSaveChanges. click() in DoSomethingInCl ient.
--
John Saunders
johnwsaundersii i at hotmail
Nov 18 '05 #2
Sorry if I'm a bit dense on this, but here is the syntax I used and it
doesn't trigger the server-side code:

function DoSomethingInCl ient() {
Do Some Stuff Here
btnSaveChanges. click();
}

How can I get the server-side code (btnSaveChanges .click()) to execute?

Thanks.
"John Saunders" <jo************ **@notcoldmail. com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
"Guadala Harry" <Ch*********@gh .com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Suppose I have a hyperlink that, when clicked, executes a JavaScript
function on the client. Separately I have a button that, when clicked,
causes a post back and executes a server-side function, as in the

following:

<a id="HyperLink5 " href="javascrip t:DoSomethingIn Client()">Do

Something</a>

<asp:Button id="btnSaveChan ges" EnableViewState ="true"
CommandName="Sa veChanges" Visible="true" Width="115" runat="server"
Text="Save Changes"></asp:Button>

What I want is to have it so that when the user clicks on the hyperlink,

the
JavaScript function executes and then the PostBack gets initiated
immediately after the JavaScript function does its thing - as if the user had clicked on the Save Changes button (but without requiring the user to click on the button). That is, I want the JavaScript to make its

client-side
changes and then cause the server-side "Save Changes" function to execute. Any ideas?


Use btnSaveChanges. click() in DoSomethingInCl ient.
--
John Saunders
johnwsaundersii i at hotmail

Nov 18 '05 #3
"Guadala Harry" <Ch*********@gh .com> wrote in message
news:Ob******** *****@TK2MSFTNG P12.phx.gbl...
Sorry if I'm a bit dense on this, but here is the syntax I used and it
doesn't trigger the server-side code:

function DoSomethingInCl ient() {
Do Some Stuff Here
btnSaveChanges. click();
}

How can I get the server-side code (btnSaveChanges .click()) to execute?
I'm surprised that didn't work.

In server code, you can call GetPostBackClie ntEvent(btnSave Changes) to get a
string containing a JavaScript function which can be called to do a
postback. I'll research this a bit and get you back some code.
--
John Saunders
johnwsaundersii i at hotmail

"John Saunders" <jo************ **@notcoldmail. com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
"Guadala Harry" <Ch*********@gh .com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Suppose I have a hyperlink that, when clicked, executes a JavaScript
function on the client. Separately I have a button that, when clicked,
causes a post back and executes a server-side function, as in the

following:

<a id="HyperLink5 " href="javascrip t:DoSomethingIn Client()">Do

Something</a>

<asp:Button id="btnSaveChan ges" EnableViewState ="true"
CommandName="Sa veChanges" Visible="true" Width="115" runat="server"
Text="Save Changes"></asp:Button>

What I want is to have it so that when the user clicks on the
hyperlink,
the
JavaScript function executes and then the PostBack gets initiated
immediately after the JavaScript function does its thing - as if the

user had clicked on the Save Changes button (but without requiring the user to click on the button). That is, I want the JavaScript to make its

client-side
changes and then cause the server-side "Save Changes" function to execute. Any ideas?


Use btnSaveChanges. click() in DoSomethingInCl ient.
--
John Saunders
johnwsaundersii i at hotmail


Nov 18 '05 #4
Hi
You can call Server Side Script from Client Script Execution.
function DoSomethingInCl ient()
{
Do Some Stuff Here
__doPostBack('b tnSaveClick','' );
}
I am using same code and its working for me....


"John Saunders" wrote:
"Guadala Harry" <Ch*********@gh .com> wrote in message
news:Ob******** *****@TK2MSFTNG P12.phx.gbl...
Sorry if I'm a bit dense on this, but here is the syntax I used and it
doesn't trigger the server-side code:

function DoSomethingInCl ient() {
Do Some Stuff Here
btnSaveChanges. click();
}

How can I get the server-side code (btnSaveChanges .click()) to execute?


I'm surprised that didn't work.

In server code, you can call GetPostBackClie ntEvent(btnSave Changes) to get a
string containing a JavaScript function which can be called to do a
postback. I'll research this a bit and get you back some code.
--
John Saunders
johnwsaundersii i at hotmail

"John Saunders" <jo************ **@notcoldmail. com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
"Guadala Harry" <Ch*********@gh .com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
> Suppose I have a hyperlink that, when clicked, executes a JavaScript
> function on the client. Separately I have a button that, when clicked,
> causes a post back and executes a server-side function, as in the
following:
>
> <a id="HyperLink5 " href="javascrip t:DoSomethingIn Client()">Do
Something</a>
>
> <asp:Button id="btnSaveChan ges" EnableViewState ="true"
> CommandName="Sa veChanges" Visible="true" Width="115" runat="server"
> Text="Save Changes"></asp:Button>
>
> What I want is to have it so that when the user clicks on the hyperlink, the
> JavaScript function executes and then the PostBack gets initiated
> immediately after the JavaScript function does its thing - as if the

user
> had clicked on the Save Changes button (but without requiring the user

to
> click on the button). That is, I want the JavaScript to make its
client-side
> changes and then cause the server-side "Save Changes" function to

execute.
> Any ideas?

Use btnSaveChanges. click() in DoSomethingInCl ient.
--
John Saunders
johnwsaundersii i at hotmail



Nov 18 '05 #5

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

Similar topics

0
2038
by: Philip Trim | last post by:
General Brief: 3 SQL Servers as MS SQL Server 2000 Standard Edition with Service Pack 3 All using FTP for snapshots All Servers are both Publishers and Distributors. Server A has the correct data needed to be replicated to Server B and C. Server B and C and have blank data. Server B and C are blank databases ready for replication. Server A publishers to Server B and Server C
5
2732
by: Grim Reaper | last post by:
My work let me put SQL Server 7.0 Enterprise Edition on my laptop. I have never setup a server from the beginning, so I am a little new at creating server groups. Alright, I am trying to create a server group. I right click on the "SQL Server Group" and make a name of "TEST" and put in the subgroup of "SQL Server Group". Next, I try to register the "TEST" server group. I right click on the "TEST" server group and New Server Group...
2
4297
by: J.Beaulieu | last post by:
Hi I'll have probably to use sql server soon but prior to that I have a question concerning priviledges and security. Is it possible for someone to do like in access, ie creating a db/table that is locked with a password? My guess is that it will be yes but in cas of... Now is it possible for someone to make a db/table read only rather than to lock it totally? Also can the guy who has an administrator priviledge on the server determine...
2
1632
by: Schrodiodo | last post by:
I need some help, please. Alphabetically: BizTalk Server
6
3784
by: Daniel Walzenbach | last post by:
Hi, I have a web application which sometimes throws an “out of memory” exception. To get an idea what happens I traced some values using performance monitor and got the following values (for one day): \\FFDS24\ASP.NET Applications(_LM_W3SVC_1_Root_ATV2004)\Errors During Execution: 7 \\FFDS24\ASP.NET Apps v1.1.4322(_LM_W3SVC_1_Root_ATV2004)\Compilations
1
6616
by: Peter | last post by:
I've purchased VS.NET 2005 Standard and have tried to install SQL Server 2005 Express, but get the following error in the error log. Please could someone help me.... Microsoft SQL Server 2005 Express Edition x86: Component Microsoft SQL Server 2005 Express Edition x86 returned an unexpected value. ***EndOfSession***? Microsoft SQL Server 2005 Express Edition x86: Component Microsoft SQL Server 2005 Express Edition x86 returned an...
9
3753
by: Matt Helm | last post by:
I am starting the design phase of a large project (ERP) where the backend will mostly be Python (or Ruby) providing web services. In this type of usage, is there any benenfit to running under Apache as opposed to a pure Python solution using Medusa, TwistedMatrix, or the like? Thanks, Matt
3
2224
by: datapro01 | last post by:
I am a DB2 DBA that has been asked to become familiar enough with SQL Server in order to become actively involved in its installation, implementation, and to review database backup/recovery procedures. SQL Server will be used by a vendor packaged application. The problem is that we are awaiting word on whether it will be SQL Server 2000 or 2005 we will be working with. I have been told that there are considerable differences between the...
16
2314
by: Jeremy S. | last post by:
I'm about to install VS.NET 2005 and SQL Server 2005 on a new/clean development machine (XP Pro/SP2 etc). Is the order of installation important (i.e., which product should I install first)? Thanks!
1
3212
by: manish deshpande | last post by:
Hi, When i'm installing MySQL-server-standard-5.0.24a-0.rhel3.i386.rpm by the following command: rpm -i MySQL-server-standard-5.0.24a-0.rhel3.i386.rpm the following error is being shown: warning: MySQL-server-standard-5.0.24a-0.rhel3.i386.rpm: V3 DSA signature: NOKEY, key ID 5072e1f5 file /etc/my.cnf from install of MySQL-server-standard-5.0.24a-0.rhel3 conflicts with file from package mysql-3.23.58-1 file...
0
8402
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8315
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8829
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8508
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8608
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6172
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 presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4164
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2733
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1627
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.