0

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 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.