473,396 Members | 1,913 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,396 software developers and data experts.

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 2296

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
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
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
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
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
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
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
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
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
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
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
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
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.