Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2008-10-01
2
Medium Priority
?
742 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 2000 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 top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

Question has a verified solution.

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

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…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
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…

670 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