DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   ASP.NET (http://www.daniweb.com/forums/forum18.html)
-   -   plz help to solve this prob (http://www.daniweb.com/forums/thread42057.html)

vaisakh Mar 28th, 2006 3:09 am
plz help to solve this prob
 
i created a session variable and try to call it on page load on another page the following error occur
: System.NullReferenceException: Object reference not set to an instance of an object.

code is


Session("name")=request(religion_list.selecteditem.text)
server.transfer("profile.aspx")

// then call

religion.selecteditem.Text = CStr(Session("name"))

Session.Remove("name")





plz help me to solve this

web_developer Mar 28th, 2006 4:28 am
Re: plz help to solve this prob
 
man
why u use request object?
u can put the session equals to the religion list directly.

session("sdf") = religion_list.selecteditem.text

vaisakh Mar 28th, 2006 4:45 am
Re: plz help to solve this prob
 
Quote:

Originally Posted by vaisakh
i created a session variable and try to call it on page load on another page the following error occur
: System.NullReferenceException: Object reference not set to an instance of an object.

code is


Session("name")=request(religion_list.selecteditem.text)
server.transfer("profile.aspx")

// then call

religion.selecteditem.Text = CStr(Session("name"))

Session.Remove("name")





plz help me to solve this

thats ok but when i call this variable on another page the following error occur
: System.NullReferenceException: Object reference not set to an instance of an object.

how should i create the instance plz


religion.selecteditem.Text = CStr(Session("name"))

Session.Remove("name")

web_developer Mar 29th, 2006 2:38 am
Re: plz help to solve this prob
 
man i think ur problem isnt in the session object but this one religion.selecteditem.Text

this object is it created in ur second page?

coz the error means u havent created an instance of object.

about the session, as i told u.
u can declare and create a one only by the following code:

session("x") = something

sam


All times are GMT -4. The time now is 3:47 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC