Solved

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

Posted on 2008-10-01
2
732 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now