.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Melody Anderson
Eminent IT

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

how to create and use session variables!!!

Posted By: krishna     Posted Date: August 04, 2012    Points:5   Category :C#
in my code, i want to store selected comp_code and com_name(array), and these two variables are used anywhere in my code??

Author: Deco             
Posted Date: August 06, 2012     Points: 20   

You can store the value in the session variable using the below code sample

Session["CompCode"] = comp_code;
Session["ComName"] = com_name;

You can retrieve the values back from the session using below sample

string compcode = Convert.ToString(Session["CompCode"]);
Array myArray = (Array)Session["ComName"];

Author: BitWise             
Posted Date: August 24, 2012     Points: 20   

Use Session Variables to create it..
Session["comp_code"] = comp_code;
Session["comp_name"] = comp_name;

Now you can use it by...

int code = (int)Session["comp_code"];
int[] ar = (int[])Session["comp_name"];


Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend