Hello everyone,
I have a problem,related to sharing variable between 2 pages.i am using session for it but it does not work,below is my code
firstpage.aspx;
protectedvoid LinkButton7_Click(object sender, EventArgs e){
Session["catagory"] = LinkButton7.Text;
Response.Redirect("secondpage.aspx");
}
Secondpage.aspx
protected
void Page_Load(object sender, EventArgs e)
{
Class1.connection();
// string catagory = Convert.ToString( Request.QueryString["catagory"]);// string month1 = Request.QueryString["monthtest"];
// Int64 test = Convert.ToInt64( month1);
string catagory=Session["catagory"].ToString();
da =newSqlDataAdapter("select * from examreference where catagory='" + catagory + "'", Class1.conn);
da.Fill(dt);
GridView1.DataSource = dt.DefaultView;
GridView1.DataBind();
}
But on secondpage.aspx i am not able to access value of session["catagory"] that means it have stored null value automatically . how i will access it
Please help
every answer is appreciated.