Passing values between asp.net page and to GA server using JavaScript
<pre><code>protected void Button_Click(object sender, CommandEventArgs e)
        {
            Response.Redirect("EnterSession.aspx?session=" + e.CommandArgument.ToString());
        }
</code></pre>

<p>the above code pass the session_id as query string to EnterSession.aspx</p>

<p>and I have the following c# related code to the EnterSession.aspx</p>

<pre><code>protected string _SessionName = null;
        public string SessionName;
        public string sessionId
        {
            get
            {
                if (null == _SessionName)
                {
                    SqlConnection thisConnection = new SqlConnection(@"data Source=sorce");
                    {
                        thisConnection.Open();
                        SqlCommand thisCommand = thisConnection.CreateCommand();
                        thisCommand.CommandText = " SELECT session_name FROM myapp_Session WHERE session_id = @SessionId;";
                        {
                            thisCommand.Parameters.AddWithValue("sessionId", sessionId);
                            SqlDataReader thisReader = thisCommand.ExecuteReader();

                            thisCommand.Parameters["@SessionId"].Value = Convert.ToInt32(Request.QueryString["session"]);

                            using (var reader = thisCommand.ExecuteReader())
                            {
                                if (reader.Read())
                                {
                                    _SessionName = reader.GetString(0);
                                }
                                else
                                {
                                    throw new ArgumentException("Invalid session id");
                                }
                            }
                        }
                    }
                }
                return _SessionName;
            }
        }
</code></pre>

<p>Now in EnterSession.aspx i used this code to pass the session_name to GA</p>

<pre><code>_gaq.push(['pageTrackerTime._trackEvent', document.getElementById('session_name').value, 'test', document.location.href, roundleaveSiteEnd]);
</code></pre>

<p>and i include this code also in EnterSession.aspx page</p>

<pre><code> &lt;input type="hidden" id="session_name" /&gt;
&lt;script type="text/javascript"&gt;
    document.getElementById('session_name').value = '&lt;%= this.SessionName %&gt;';
&lt;/script&gt;
</code></pre>

<p>Now I cannot find the session_name passed to GA server.</p>

<p>can somebody tell me where i made the mistake ..thanx </p>
