NullReferenceException

M

mohit

Hi all,
I am creating a web application on web matrix.I have a
datagrid.I have the following code :
DataTable dt=(DataTable)Session["DataGrid"];

DataRow dr = dt.NewRow();

DataView dv;
First it was giving correct result.After that I run the same code then
it is giving the following error message :

Exception Details: System.NullReferenceException: Object reference not
set to an instance of an object.

for the line DataRow dr = dt.NewRow();

what can be the problem??
Any ideas???
 
E

Elton Wang

Error itself shows that there is no data in Session["DataGrid"]. Check if
you save datatable to the Session before you retrieve it.



HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Functioning website now fails 0
ViewState and DataTable 1
aspnet examples question 3
CreateDataTableInCode\PopulateDataGrid 2
nullreferenceexception 1
ds and Session 2
Add controls in datatable 1
DATASET 0

Members online

No members online now.

Forum statistics

Threads
474,265
Messages
2,571,069
Members
48,771
Latest member
ElysaD

Latest Threads

Top