according to this code, how can i trigger a function in the code behind file when the hidden value changes in the script???
i tried the hidden events but it didn't work & i couldn't know wht's wrong with it

The only solution is to assign value to a control and then read it using js.

Here is the sample what I did,
In the aspx page:

1. Create a hidden control

<INPUT id="name_hidden" type="hidden" runat="server">

2. Read the hidden control value(session variable)

var varName=document.getElementById('name_hidden').value;

In the Code behind file:

3. Set the value for hidden control on run time

name_hidden.Value = Session("UserName")

Hope it will work for you!