That means that the Session["saat"] is null and has no value in it.Check your code to make sure you are assigning a value into the session i.e. Session["saat"] = "Some Value";
In the above statement you are checkking the value of Session["saat"] and if it null then you are defaulting the value of TextBox2.Text to string.Empty or else you are assigning the value in Session["saat"].
*** If this post helps you, then Mark this post as Answer ***
Line 16: TextBox3.Text = Session["clock"].ToString(); Line 17:
You are not getting any value in that Session["clock"].ToString();
you need to check first whether it is null or not
if( Session["clock"].ToString() ==null)
{
}
else
{
navigare
Member
3 Points
27 Posts
server error related a session
Nov 28, 2012 06:58 PM|LINK
i get a server error that "System.NullReferenceException – Object reference not set to an instance of an object"
and following its
inquisitive_...
Contributor
3421 Points
575 Posts
Re: server error related a session
Nov 28, 2012 07:36 PM|LINK
Check for null reference
while(1)
navigare
Member
3 Points
27 Posts
Re: server error related a session
Nov 28, 2012 08:09 PM|LINK
now i ain't getting an error but , i defined two session following sentences
TextBox1.Text = Session["kuafor"] == null ? string.Empty : Session["kuafor"].ToString(); TextBox2.Text = Session["saat"] == null ? string.Empty : Session["saat"].ToString(); first one works,second one doesn't work it returns string.Emptyinquisitive_...
Contributor
3421 Points
575 Posts
Re: server error related a session
Nov 28, 2012 08:20 PM|LINK
That means that the Session["saat"] is null and has no value in it.Check your code to make sure you are assigning a value into the session i.e. Session["saat"] = "Some Value";
In the above statement you are checkking the value of Session["saat"] and if it null then you are defaulting the value of TextBox2.Text to string.Empty or else you are assigning the value in Session["saat"].while(1)
navigare
Member
3 Points
27 Posts
Re: server error related a session
Nov 28, 2012 08:29 PM|LINK
i assigned a value to Session["saat"] as below,
protected void LinkButton1_Click(object sender, EventArgs e)
{
Label9.Text = LinkButton1.Text;
Session["saat"] = Label9.Text;
}
and i called this way,
inquisitive_...
Contributor
3421 Points
575 Posts
Re: server error related a session
Nov 28, 2012 09:37 PM|LINK
Did you click the linkbutton and what is the linkbutton text?
while(1)
sureshtalla
Member
11 Points
82 Posts
Re: server error related a session
Nov 28, 2012 10:03 PM|LINK
Line 16: TextBox3.Text = Session["clock"].ToString(); Line 17:
You are not getting any value in that Session["clock"].ToString();
you need to check first whether it is null or not
if( Session["clock"].ToString() ==null)
{
}
else
{
oned_gk
All-Star
31515 Points
6433 Posts
Re: server error related a session
Nov 28, 2012 10:07 PM|LINK
If (Session["clock"]!=null) { TextBox3.Text = Session["clock"].ToString(); }navigare
Member
3 Points
27 Posts
Re: server error related a session
Nov 29, 2012 10:08 AM|LINK
Linkbutton.Text=09:00;
Catherine Sh...
All-Star
23382 Points
2490 Posts
Microsoft
Re: server error related a session
Dec 04, 2012 06:18 AM|LINK
Hi,
Please set a breakpoint at the code above and check whether LinkButton1.Text is null at first.
If you want to assign value to linkbutton, you need to convert it to string. Please modify your code above as follows:
Best wishes,
Feedback to us
Develop and promote your apps in Windows Store