We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

[NullReferenceException: Object reference not set to an instance of an object.]

Thread ID:

Created:

Updated:

Platform:

Replies:

69344 Oct 24,2007 03:34 PM Oct 31,2007 04:03 AM ASP.NET Web Forms (Classic) 1
loading
Tags: Grouping
mahesh mohite
Asked On October 24, 2007 03:34 PM

Hello,

I have a grid that binds a datasource. Now that the number of columns in the datasource are changed when the grid loads, I get above error. Please see the following stack trace

[NullReferenceException: Object reference not set to an instance of an object.]
Syncfusion.Web.UI.WebControls.Grid.Grouping.Utils.GetRecordId(Record r)
Syncfusion.Web.UI.WebControls.Grid.Grouping.Utils.GetTableElementKey(Object tableElement)
Syncfusion.Web.UI.WebControls.Grid.Grouping.GridRow..ctor(Element e, GridTable gTable, GridGroupingControl parent, Int32 eIndex)
Syncfusion.Web.UI.WebControls.Grid.Grouping.GridGroupingControl.CreateRowFromDisplayElement(Element e, Int32 rowIndex, GridTable gTable)
Syncfusion.Web.UI.WebControls.Grid.Grouping.GridGroupingControl.RenderVisiblePage(Table table, GridTable gTable, ChildTable cTable, PageInfo pi, GridPageInfo gpi, Boolean currentRecordFound)
Syncfusion.Web.UI.WebControls.Grid.Grouping.GridGroupingControl.InitHtmlTableFromGridTable(Table table, GridTable gTable, ChildTable cTable, Int32 curPage, Int32 pageSize)
Syncfusion.Web.UI.WebControls.Grid.Grouping.GridGroupingControl.CreateControlHierarchy()
Syncfusion.Web.UI.WebControls.Grid.Grouping.GridGroupingControl.OnPreRender(EventArgs e)
System.Web.UI.Control.PreRenderRecursiveInternal()
System.Web.UI.Control.PreRenderRecursiveInternal()
System.Web.UI.Control.PreRenderRecursiveInternal()
System.Web.UI.Control.PreRenderRecursiveInternal()
System.Web.UI.Page.ProcessRequestMain()

Any suggestions/comments would appreciated

Melba Winshia [Syncfusion]
Replied On October 31, 2007 04:03 AM

Hi Mahesh,

We regret for the delayed response.

Normally if a grid is bound with datasource and then you are changing the columns in the datasource, you should rebind the datasource to grid by using the below code snippet:

[C#]

this.gridGroupingControl1.DataSource = null;
this.gridGroupingControl1.DataMember = null;
this.gridGroupingControl1.ResetTableDescriptor();
this.gridGroupingControl1.TableDescriptor.Relations.Clear();
this.gridGroupingControl1.DataSource = newdatasource;
this.gridGroupingControl1.Refresh();

Please refer the sample in the below link which illustrates the above:

http://websamples.syncfusion.com/samples/Grid.Web/5.2.0.25/69344_1/main.htm

Please have a look at the above sample and if still the issue exists, could you please try reproducing it in the above sample and send us the modified sample so that we could sort out the cause of the issue and provide you a solution?

Thanks,
Melba

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;