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


Top 5 Contributors of the Month
david stephan

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

Arraylist

Posted By: shabazsh     Posted Date: September 23, 2008    Points:2   Category :ASP.Net
i m trying to add a session value into array list via this code
if (Session["item_name"] != null && Session["item_desc"] != null)
{ al_name.Add(Session["item_name"].ToString());
al_price.Add(Session["item_desc"].ToString()); }

but i m getting an error:Object reference not set to an instance of an object.

Responses
Author: Amit Mehra             
Posted Date: September 23, 2008     Points: 5   

Hi,
try like this

ArrayList al_name = new ArrayList();
ArrayList al_price = new ArrayList();

if (Session["item_name"] != null && Session["item_desc"] != null)
{
al_name.Add(Session["item_name"].ToString());
al_price.Add(Session["item_desc"].ToString());
}



Thanks,
Amit
Please "Mark As Answer " if this post help you.


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
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

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