0

I am taking the the GridView row count in session and then displaying the session value to a label.

I am displaying it in the master page but it is not executing its throwing this error

Object reference not set to an instance of an object.

Can anyone help me?

My Code:

Session["Count"] = GridView1.Rows.Count.ToString();
Label1.Text = Session["Count"].ToString();
Aria
  • 3,724
  • 1
  • 20
  • 51
  • Why don't directly assign count.ToString to label.text? Why use session? – Chetan Nov 12 '17 at 05:35
  • This is quite clear that your count Session did not created, where that session created in which event?, provide more code. – Aria Nov 12 '17 at 06:01
  • I created this in shopping cart page and set the count of gridview row in session and trying to display it to the master page.If i m missing something then plz explain – Suvendu Bhattacharjee Nov 12 '17 at 06:33

0 Answers0