954,593 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Calling C# function(code behind) from javascript function

Hi,

I have a problem in my code.
I am putting a image icon in my coe and want to call the code behind function Left_Click() on its OnClick() event.
But the Click event is generating after two times clicking.
and I have wriiten in the Page Load event
I want to write in PageLoad() method

as.Add.Attributes("onclick","javascript:Lef_Click();return false;);

For this I have to write a javascript function Lef_Click() and have to call that code behind function Left_Click() in it.
Is there any method to do this.
Please! Help me out.

Ninad
Newbie Poster
7 posts since Sep 2007
Reputation Points: 10
Solved Threads: 0
 

u can call a code behind function from JS as


var str = '<%=M1()%>'

where M1() is a server side function . it shuold return some string to JS variable str.

veeru8787
Newbie Poster
1 post since Jun 2010
Reputation Points: 10
Solved Threads: 0
 

How can i send parameters to the function?

mohanms
Newbie Poster
1 post since Sep 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You