Object reference not set to an instance of an object.

From: Alex (Alex_at_discussions.microsoft.com)
Date: 06/29/04


Date: Tue, 29 Jun 2004 16:12:02 -0700

I am pulling my hair out. Please help!

I have a dataset i'm using to populate a number of datagrids

in the masterDataGrid_ItemCreated event handler, i have added code to add a component name from the dataset. It works perfectly when it first loads.

Dim Component_Name As String = objDS.Tables("components").Rows(e.Item.DataSetIndex).Item("cpt_Title").ToString()
                
When it posts back, however, i get

Object reference not set to an instance of an object.

I have tried having the dataset load in both the Page_Load and Page_Init subs and it didn't make a difference. Also objDS is declared as a private dataset in the initial declarations (changing it to public didn't help either).

If anyone can at least point me in the right direction, i would appreciate it.

Thanks