hi all. in my shopping cart project , i tested with two buttons, one for execution of client click and another for exection server method. these two buttons are as follows.. <input id="addbutton" type="button" value="Add Products" onclick='addToB asket(<%#DataBi nder.Eval(Conta iner.DataItem, "ProductNo")%>) ' />
//this button used for execution for javascript method... <asp:Button ID="Button1" runat="server" Commandname='<% #DataBinder.Eva l(Container.Dat aItem, "ProductNo" ) %> ' OnCommand="Filt erData" Text="Add to Cart" /></br>
// this button used for execution of serverside method..
Now i need to combine both button functons in a single button..(ie) when i click the button it execute both javascript function and also server side code..
is it possible.. any one know how to do this..
i am waiting for your reply..
thank you...
4 1383
It is definitely possible: -
<asp:Button ID="btnDo" OnClientClick="return addToBasket()" CommandName="" OnClick="btnDo_Click" runat="server" />
-
This will call the javascript method addToBasket, and assuming it doesn't return false, it will then do the server postback and call btnDo_Click
It is definitely possible: -
<asp:Button ID="btnDo" OnClientClick="return addToBasket()" CommandName="" OnClick="btnDo_Click" runat="server" />
-
This will call the javascript method addToBasket, and assuming it doesn't return false, it will then do the server postback and call btnDo_Click
Hi. Thank u for ur Reply..
I tried ur code..
<asp:Button ID="Button1" Text="add to cart" OnClientClick=' return addToBasket(<%# DataBinder.Eval (Container.Data Item, "ProductNo")%>) ' OnCommand="Filt erData" CommandName='<% #DataBinder.Eva l(Container.Dat aItem, "ProductNo" )%>' runat="server" />
But it didnt call clientside script (javascript function add to basket)..
Thanks again
hi.
just try this way.
in aspx.cs page add
buttonserver.at tributes.add("o nclick","javasc riptfunction()" ) inline code
javascript function()
{
if()
{ coding
return true; //go to server
}
else
{ coding
return false; // don't go to server
}
}
The code is valid as I've run it myself. View the HTML output of the aspx page and ensure the button has the onclick attribute added and the js function name is valid, etc.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Bartosz Wegrzyn |
last post by:
I need help with sessions.
I createt set of web site for nav with authorization.
first I go into main.php which looks like this:
<?php
//common functions
include_once '../login/common.php';
global $LOGINDIR;
|
by: Boris Nikolaevich |
last post by:
This is backwards of what I usually want--normally if you have a
long-running ASP script, it's a good idea to check to see whether the client
is still connected so you can cancel execution.
However, I have a script that absolutely MUST finish one it's been
started--is there a way to cause the entire script to execute, even if the
client disconnects in the middle of the process? It doesn't matter if the
script returns anything to the...
|
by: Alastair Anderson |
last post by:
I have created a very simple form with which I would like to update a
single
value in a single row of a database as a proof of concept.
The relevant parts of the form are a DBWebTextBox (which is hooked
into a
column ORGANISATION.SHORT_NAME) and a Button which I am using as a
submit
button.
|
by: Nedu N |
last post by:
Hi All,
I am facing a typical problem in my .NET application with the pop-up script
messages. The thing is that its working fine when i run on my development
machine but not running in expected manner when i move it to Prod
environment. Please have a look at the following code snippet...
//Page name - Add.aspx
private void Page_Load(object sender, System.EventArgs e)
|
by: ElanKathir |
last post by:
Hi !
I wrote one code for Send the E-mail, But that code have some problem , So please help me
Here i paste my code and Error:
Error:
Server Error in '/Elan_Sample' Application.
--------------------------------------------------------------------------------
| |
by: Guadala Harry |
last post by:
I have some client-side JavaScript that, among other things, calculates the
value of a variable (myVar). On the server I have a stored procedure that
needs to somehow receive as an input parameter the value of myVar. I need to
know how to get the value of myVar from the script up to the server.
Specifically, I'd like to have the following happen when the user clicks a
button in the browser:
1. The client-side script executes (and...
|
by: Rea |
last post by:
Hi eb
I set some 'Stop' statements and also visual breakpoints
in asp code (vbscript).
I am doing that in Microsoft Script debugger.
Than I refresh the original page and expect execution to halt
at these breakpoints but unfortunatly it does not..
I had allowed script debugging in both iis home directory and in internet
explorer.
Also i added everyone from active directory to be members of debugging group.
Web Server is W2k sp4 and iis...
|
by: HC |
last post by:
Hello, all, I started out thinking my problems were elsewhere but as I
have worked through this I have isolated my problem, currently, as a
difference between MSDE and SQL Express 2005 (I'll just call it
Express for simplicity).
I have, to try to simplify things, put the exact same DB on two
systems, one running MSDE and one running Express. Both have 2 Ghz
processors (one Intel, one AMD), both have a decent amount of RAM
(Intel system...
|
by: Guillermo Antonio Amaral Bastidas |
last post by:
Hi everybody,
I have a quick and probably dumb question, keep in mind I just
dumped my old love FastCGI + Perl for it's younger hotter friend PHP5.
If the user calls a time consuming script and then stops or refreshes
the browser before the script had time to finish will Apache kill the
script mid execution or will it let it finish ?
I ask this stupid question because this seems to be happening in one
|
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,...
|
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...
| |
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,...
|
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...
|
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 project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |