473,398 Members | 2,525 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,398 software developers and data experts.

How to make a button to have both server side and client event in ASP.NET?

HI all ,

I want to make a button which have a server side OnClick event in .cs to
update the DB. But I want it to have a client side onclick event to run
a javascript popup too. And the javascript will be run only in some
conditions determine by the input of some webcontrols. Finally the
server side event will depend on the chioce of user in the javascript
popup.

How can i achieve it ?

thX ~

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #1
4 1607
"Lau Alvin" <cl****@ie.cuhk.edu.hk> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
I want to make a button which have a server side OnClick event in .cs to
update the DB. But I want it to have a client side onclick event to run
a javascript popup too. And the javascript will be run only in some
conditions determine by the input of some webcontrols. Finally the
server side event will depend on the chioce of user in the javascript
popup.

How can i achieve it ?


I think you're trying to make life difficult for yourself! I would suggest:

1) The button calls a client-side JavaScript function which loads the popup.

2) The user makes whatever choices you require in the popup then click an OK
button when finished.

3) The OK button in the popup calls a server-side function (or just
submits!) which updates the database and closes the popup.
Nov 18 '05 #2
Lau,

See if this article helps.

http://www.developerfusion.com/show/4505/

Alan
"Lau Alvin" <cl****@ie.cuhk.edu.hk> wrote in message
news:#P*************@TK2MSFTNGP10.phx.gbl...
HI all ,

I want to make a button which have a server side OnClick event in .cs to
update the DB. But I want it to have a client side onclick event to run
a javascript popup too. And the javascript will be run only in some
conditions determine by the input of some webcontrols. Finally the
server side event will depend on the chioce of user in the javascript
popup.

How can i achieve it ?

thX ~

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #3

Thx All ~
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #4
btnId.Attributes.Add("onclick", "ClientSideFunctionName();") and the normal
way for server-side.

Karl

"Lau Alvin Lau" <cl****@ie.cuhk.edu.hk> wrote in message
news:Ol*************@tk2msftngp13.phx.gbl...

Thx All ~
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #5

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

Similar topics

4
by: yfng | last post by:
In a web form, I want the user clicks on one button and this button will trigger another button/link which will open a new browser window? How to do that? Is there any method like...
2
by: Yama | last post by:
Hi, I have a button which is a server-side control. If a client-side error on a form is produced and a javascript (client-side) is fired how do I avoid the server-side button_client event to...
7
by: IntraRELY | last post by:
I am using the following command to launch and .NET VB Executable, which is a simple Windows Form (printCheckClient.exe). I am using a HyperLink Control and works perfect....
1
by: Bin Song, MCP | last post by:
Hi all I got a strange problem In my webform, I have a server-side Button "btnDisable" to save some data and enable or disable all other fields in this form based on the data. The logic is: on...
5
by: TS | last post by:
for some reason, it posts to the server, but no click events of any buttons on form fire. the button is the first one on the form. when the focus is inside the textbox, it doesnt' work. if i click...
3
by: wardy1975 | last post by:
Hi all....looking for a bit of help here....I'm using an asp.net server side button, and trying to add an onclick event on the button to call a javascript function. However, I am trying to enter...
11
by: bill | last post by:
I dynamically create buttons and associate them with an event using AddHandler. I want all the button events to fire at one time, when the page is posted, instead of when each button is clicked....
2
by: moondaddy | last post by:
I have an asp.net 2.0 application and put a html button on a web page. I double clicked on the button and it crated the event handler for me and created the stub js function for it like this: ...
6
by: erdos | last post by:
I have an asp.net 2.0 button with server and client side click events. On the first click, both events will fire. On the next click, only the client side event fires. How do I make the server...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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,...
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
agi2029
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,...

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.