Solved

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

Posted on 2008-10-01
2
740 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
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…
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…
Suggested Courses

622 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