Solved

How to call javascript methods in .js file manually from .aspx.cs file (c#)

Posted on 2008-10-01
2
737 Views
Last Modified: 2013-12-17
I have a C# VS .NET 2.0 project.
All the js code is in a .js file.
In the code behind (testPage.aspx.cs), we add methods from the .js file to the asp controls. For instance, we have a radio button: rbTestButton. In the code behind, we add the OnClick attribute using a method in the .js file:
rbTestButton.Attributes.Add("OnClick", "jsMethodFromJsFile()").
so whenever rbTestButton is clicked, method jsMethodFromJsFile() executes.

I want to call this method manually from the code behind. Is this possible?

Thx.
0
Comment
Question by:fippif
2 Comments
 
LVL 6

Accepted Solution

by:
ysfx earned 500 total points
ID: 22619252
No, because Javascript is executed on the client side. Execution in .NET is on server end.

If you describe what you are trying to accomplish, someone may be able to assist you further.
0
 

Author Closing Comment

by:fippif
ID: 31502178
Thx.
0

Featured Post

The New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question