Devendra  Kumar

Devendra Kumar

  • 1.5k
  • 517
  • 192.3k

passing id throw session in c# .net

May 18 2016 3:33 AM
hi frnds how to  store id throw session and pass this session value another
 
i will use like this: 
 
if (chkBx != null && chkBx.Checked)
{
TextBox txt = (TextBox)di.FindControl("lbl_wokid");
Session["id"] =(txt);
}
 
store value in session["id"] and pass this value like: 
 
objadmin.Work_Id = Convert.ToInt32(Session["id"]); 
 
but getting error  
 
Unable to cast object of type 'System.Web.UI.WebControls.TextBox' to type 'System.IConvertible'.
 

Answers (2)