Access javascript function from

From Default.aspx.cs how do call a JavaScript function whenever a textbox is changed?


protected void Button1_Click(object sender, EventArgs e)
               int somevalue = 1;
               //call javascript getvalue(somevalue)?????????


<script type="text/javascript">
      function getvalue(somevalue){
ps: I need to use the variable "somevalue" or else I would put it in the html "Button1 OnClick. 

It’s not possible to call a JS function from serverside code like that. If you want to pass a server generated value to a JS script you’ll need to output it into the page when you render it, so that the JS can access it when it’s executed in the browser:

<script type="text/javascript">
      var somevalue = <%= somevalue %>;

(apologies if the syntax is wrong, I don’t use the language)