Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
4695
Object reference not set to an instance of an object.
posted

Dear all,

I have below code and don't know why in datasource=, it throw exception??

DataSet ds1 = new DataSet();
            ds1.Tables.Add(this.itemListTable);
            ds1.Tables.Add(this.productListTable);
            ds1.Tables.Add(this.categoryListTable);
            ds1.Relations.Add(ds1.Tables["List1"].Columns["PromoCode"], ds1.Tables["ProductInfo"].Columns["PromoCode"]);
            ds1.Relations.Add(ds1.Tables["List1"].Columns["PromoCode"], ds1.Tables["CategoryInfo"].Columns["PromoCode"]);

            this.ultraGrid1.DataSource = ds1;   // throw exception here

Parents
  • 469350
    Offline posted

    Hi,

    Can you post the Call Stack of the exception?

    It's hard to guess without that information. But my guesses would be:

    • Your grid has a DataMember set which does not exist in the new DataSet you are attaching.
    • You are handling some events of the grid such as InitializeLayout or InitializeRow and your code is trying to reference an object (cell or column) that does not exist.

     

Reply Children