Access javascript function from ASP.net

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

Default.aspx.cs

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

Default.aspx

<script type="text/javascript">
      function getvalue(somevalue){
           //somedata
      }
</script>
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 %>;
</script>

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