As Sergey said you cannot assign as javascript variable directly to code behind,
what you can do is like
create a
hidden field
variable in the client side as
<asp:HiddenField ID="hdnfldVariable" runat="server" />
and in the
javascript
you can assign some value to the hidden variable as
<script type="text/javascript">
var somefunction = function () {
var hdnfldVariable = document.getElementById('hdnfldVariable');
hdnfldVariable.value = 'value from javascript';
}
</script>
and you can read the hidden field variable in the
code behind
as
string variable = hdnfldVariable.Value;