Groups | Blog | Home
all groups > asp.net datagrid control > december 2005 >

asp.net datagrid control : NullReferenceException


mohit
12/24/2005 8:10:41 AM
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???
Elton Wang
12/25/2005 10:08:40 AM
Error itself shows that there is no data in Session["DataGrid"]. Check if
you save datatable to the Session before you retrieve it.



HTH





[quoted text, click to view]

AddThis Social Bookmark Button