views:

38

answers:

2

Hi i wanted to call a C# function through javascript code.

For Eg: i have C# function which is in aspx.cs page

public void setValue()
{
   lblMsg.Text = "hello";
   ....
   .....  
}

from javascript i need to call this function.

+2  A: 

Hello. This is not possible directly indeed. If you are using Web Forms you can have a C# button handler which will change text of your label in server side and then you can call the _doPostBack function for that handler.

Alex Krupnov
Thanks Alex. I resolve it by involving __doPostBack
GayaMani
+1  A: 

Somehow you have to do as postback, either complete or partial. Use AJAX (UpdatePanel)

Jeroen