473,498 Members | 1,725 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

asp.net C# Button_click event and javascript function

Hi,

What I want to do here is in the asp.net C#, when I click a button then some
sorts of validation will be checked, then it will call a javascript function
to open another webform. Would someone tell me how to involve the
javascript function in the C# button_click event?
Thanks for help.

Jason
Nov 17 '05 #1
1 2298

Hi Jason,

I'm assuming that you are creating your button dynamically (as in
inside the .cs side of your page). If you are then just add a
attribute to your button of type "onclick". This means that when .NE
finally compiles the page sent to the client, you will have you
'onclick="..?..."' in the button tag which can then point to th
javascript function.

Just remember that if the button is also your default submit button o
your form, you will have to "catch" the form submission
onsubmit="javascript: return function1()" on form tag) and return th
appropriate action (true or false).

Happy coding!
Fuzzymelon.co

--
fuzzymelo
-----------------------------------------------------------------------
fuzzymelon's Profile: http://www.msusenet.com/member.php?userid=245
View this thread: http://www.msusenet.com/t-187055243

Nov 17 '05 #2

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

Similar topics

10
3556
by: tony kulik | last post by:
This code works fine in ie and opera but not at all in Mozilla. Anybody got a clue as to how to get it right? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <script...
0
377
by: Jason Huang | last post by:
Hi, What I want to do here is in the asp.net C#, when I click a button then some sorts of validation will be checked, then it will call a javascript function to open another webform. Would...
3
2546
by: Tim Thomas | last post by:
Hi, I am very new to .NET and am in the process of building my first web application. I will briefly describe what i am trying to achieve: I have a system where suppliers register their...
2
2523
by: Frank Schumacher | last post by:
Hi Folks, I have a problem with the order of events fired by ASP.NET. I found many articles which explaining the lifecycle of a site, but I found none which took the event from a Control on the...
3
2457
by: I am Sam | last post by:
Please help. I'm dying here and pulling out the last few remaining elements of my hair over this. I have built a form that will identify and authenticate users. I keep getting the following...
3
1125
by: Morten Wennevik | last post by:
Hi, I need to launch a new browser window while keeping the current window. This must be done server-side and inside the button-click event as parameters etc will be generated there. How can...
13
1957
by: Matt | last post by:
I am trying to call a recursive subroutine within a Button_Click event. How can I do this? I tried to create a seperate Function() but it will not allow me to use any variables that I created in...
0
1872
by: John | last post by:
I am loading my controls dynamically into my asp.net page. When I click on a button on one of those user controls then page reloads and I need to reload the page based on what has happened in the...
1
6449
by: wesly | last post by:
How to call a button_ click event from javascript function i need syntax for call a button click event from javascript.
0
951
by: Chetana | last post by:
Hi, How to call any javascript function from button_click function.It means first executes the inside logic of button _click() function and then calls javascript function. Thanks, Chetana
0
7125
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
7002
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
5462
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,...
1
4910
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...
0
4590
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3085
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1419
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 ...
1
656
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
291
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...

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.