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="javascript:DoSomethingInClient()">Do Something</a>
<asp:Button id="btnSaveChanges" EnableViewState="true"
CommandName="SaveChanges" 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! 4 3106
"Guadala Harry" <Ch*********@gh.com> wrote in message
news:%2****************@TK2MSFTNGP09.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="javascript:DoSomethingInClient()">Do
Something</a> <asp:Button id="btnSaveChanges" EnableViewState="true" CommandName="SaveChanges" 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 DoSomethingInClient.
--
John Saunders
johnwsaundersiii at hotmail
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 DoSomethingInClient() {
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****************@TK2MSFTNGP09.phx.gbl... "Guadala Harry" <Ch*********@gh.com> wrote in message news:%2****************@TK2MSFTNGP09.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="javascript:DoSomethingInClient()">Do
Something</a> <asp:Button id="btnSaveChanges" EnableViewState="true" CommandName="SaveChanges" 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 DoSomethingInClient. -- John Saunders johnwsaundersiii at hotmail
"Guadala Harry" <Ch*********@gh.com> wrote in message
news:Ob*************@TK2MSFTNGP12.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 DoSomethingInClient() { 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 GetPostBackClientEvent(btnSaveChanges) 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
johnwsaundersiii at hotmail
"John Saunders" <jo**************@notcoldmail.com> wrote in message news:%2****************@TK2MSFTNGP09.phx.gbl... "Guadala Harry" <Ch*********@gh.com> wrote in message news:%2****************@TK2MSFTNGP09.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="javascript:DoSomethingInClient()">Do
Something</a> <asp:Button id="btnSaveChanges" EnableViewState="true" CommandName="SaveChanges" 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 DoSomethingInClient. -- John Saunders johnwsaundersiii at hotmail
Hi
You can call Server Side Script from Client Script Execution.
function DoSomethingInClient()
{
Do Some Stuff Here
__doPostBack('btnSaveClick','');
}
I am using same code and its working for me....
"John Saunders" wrote: "Guadala Harry" <Ch*********@gh.com> wrote in message news:Ob*************@TK2MSFTNGP12.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 DoSomethingInClient() { 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 GetPostBackClientEvent(btnSaveChanges) 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 johnwsaundersiii at hotmail
"John Saunders" <jo**************@notcoldmail.com> wrote in message news:%2****************@TK2MSFTNGP09.phx.gbl... "Guadala Harry" <Ch*********@gh.com> wrote in message news:%2****************@TK2MSFTNGP09.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="javascript:DoSomethingInClient()">Do Something</a> > > <asp:Button id="btnSaveChanges" EnableViewState="true" > CommandName="SaveChanges" 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 DoSomethingInClient. -- John Saunders johnwsaundersiii at hotmail
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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...
|
by: Schrodiodo |
last post by:
I need some help, please.
Alphabetically:
BizTalk Server
|
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...
|
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...
|
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...
|
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...
|
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)?
...
|
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:
...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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...
|
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,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
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...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
| |