using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;
using System.Text;
using System.Web.Services;
using System.IO;
namespace T_Smade
{
public partial class ConferenceManagement : System.Web.UI.Page
{
volatile int i = 0;
protected void Page_Load(object sender, EventArgs e)
{
GetSessionList();
}
public void GetSessionList()
{
string secondResult = "";
string userName = "";
try
{
if (HttpContext.Current.User.Identity.IsAuthenticated)
{
userName = HttpContext.Current.User.Identity.Name;
}
SqlConnection thisConnection = new SqlConnection(@"data Source=ZOLA-PC;AttachDbFilename=D:\2\5.Devp\my DB\ASPNETDB.MDF;Integrated Security=True");
thisConnection.Open();
SqlCommand secondCommand = thisConnection.CreateCommand();
secondCommand.CommandText = "SELECT myApp_Session.session_id FROM myApp_Session, myApp_Role_in_Session where myApp_Role_in_Session.user_name='" + userName + "' and myApp_Role_in_Session.session_id=myApp_Session.session_id";
SqlDataReader secondReader = secondCommand.ExecuteReader();
while (secondReader.Read())
{
secondResult = secondResult + secondReader["session_id"].ToString() + ";";
}
secondReader.Close();
SqlCommand thisCommand = thisConnection.CreateCommand();
thisCommand.CommandText = "SELECT * FROM myApp_Session;";
SqlDataReader thisReader = thisCommand.ExecuteReader();
while (thisReader.Read())
{
test.Controls.Add(GetLabel(thisReader["session_id"].ToString(), thisReader["session_name"].ToString()));
string[] compare = secondResult.Split(';');
foreach (string word in compare)
{
if (word == thisReader["session_id"].ToString())
{
test.Controls.Add(GetButton(thisReader["session_name"].ToString(), "Join Session"));
}
}
}
thisReader.Close();
thisConnection.Close();
}
catch (SqlException ex)
{
}
}
private Button GetButton(string id, string name)
{
Button b = new Button();
b.Text = name;
b.ID = "Button_" + id + i;
b.Command += new CommandEventHandler(Button_Click);
b.CommandArgument = id;
i++;
return b;
}
private Label GetLabel(string id, string name)
{
Label tb = new Label();
tb.Text = name;
tb.ID = id;
return tb;
}
protected void Button_Click(object sender, CommandEventArgs e)
{
Response.Redirect("EnterSession.aspx?session=" + e.CommandArgument.ToString());
}
}
I have this code when a user clicks a button
www.mypage/EnterSession.aspx?session=session_name
in the EnterSession.aspx i have used the code below to track the current URL
_gaq.push(['pageTrackerTime._trackEvent', 'Category', 'Action', document.location.href, roundleaveSiteEnd]);
Now I would also like to track in the Action parameter the session_name from the previous page.see the code below from the previous page
test.Controls.Add(GetButton(thisReader["session_name"].ToString(), "Join Session"));
Some idea how to do it?
Thanx