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

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,150
Latest member
MakersCBDReviews
Top