System.NullReferenceException :Object variable or

Results 1 to 2 of 2

Thread: System.NullReferenceException :Object variable or

  1. #1
    Join Date
    Dec 1969

    Default System.NullReferenceException :Object variable or

    I have gone mad debugging this problem. Can you please tell me why thi sis happeneing .. It was working fine and then suddenly this. Heres my code.. this is my databinding sub<BR><BR>----open connection<BR>dim ds as new dataset("mydbname")<BR>---sql string<BR>dim dsc as new sqldataadapter(sql,myconnection)<BR>dsc.fill(ds)<B R>Details.DataSource=ds<BR>Details.databind()<BR>m yconnection.close()<BR><BR>And then on the onitemdatabound method from datagrid i am calling this function <BR><BR>sub getresultdetail(sender as object,e as DataGridItemEventArgs)<BR>lbl_msg.text = e.item.DataItem("orderid") ---&#062; this is where i get the error msg<BR>end sub

  2. #2

    Default RE: System.NullReferenceException :Object variable

    You need to check the e.Item.ItemType, you won&#039;t have a dataitem if you are on a header or footer item.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts