Skip to content

Infragistics Community Forum / Cross Platform / Ultimate UI for Xamarin / NullReferenceException when databinding new datasource

NullReferenceException when databinding new datasource

New Discussion
Vincent
Vincent asked on Feb 7, 2008 9:08 PM

I have a simple UltraWebGrid that displays the search results based on several criteria.  It is working fine until the user clicks on a header to sort the grid.  The grid performed the sort just fine; however, when the user enter new search criteria, an NullReferenceException is generated when calling DataBind on the grid.

uwgResult.DataSource = aDataTable
uwgResult.DataBind <- This call will generate an exception only after user clicks on any header to sort

Could someone tell me what should be the “correct” way of data binding a new data source?

Thanks.

 

Sign In to post a reply

Replies

  • 0
    Darrell Kress
    Darrell Kress answered on Feb 7, 2008 8:04 PM

    One thing that might help would be set the DataSource = null (nothing in VB), calling DataBind() and then binding the new datasource.  But without being able to see what might be causing the issue, thats about all I can suggest.

    • 0
      Vincent
      Vincent answered on Feb 7, 2008 8:39 PM

      I did try that before, same thing happened. I have verified that the new data set has the correct data in it…..

      And here is the stack trace when I called DataBind

         at Infragistics.WebUI.UltraWebGrid.RowsCollection.Sort()
         at Infragistics.WebUI.UltraWebGrid.UltraWebGrid.SortGroupRows(RowsCollection rows)
         at Infragistics.WebUI.UltraWebGrid.UltraWebGrid.PerformGroupRows()
         at Infragistics.WebUI.UltraWebGrid.DBBinding.BindList(IEnumerable datasource)
         at Infragistics.WebUI.UltraWebGrid.DBBinding.DataBind(Object dataSource, String dataMember)
         at Infragistics.WebUI.UltraWebGrid.UltraWebGrid.DataBind()
         at Results_DailyResults.BindData(DataSet& myDataSet)
         at Results_DailyResults.SubmitButtonClicked
         at System.EventHandler.Invoke(Object sender, EventArgs e)
         at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
         at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
         at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
         at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
         at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
         at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

      If I use UpdatePanel, I got the error page, but if I use AsyncRefreshPanel, the page post back due to that error as if nothing happened… 

      • 0
        Darrell Kress
        Darrell Kress answered on Feb 7, 2008 8:45 PM

        I guess you could try clearing the SortedColumns collection (I thought that would clear with the null databind).

         

        If that doesn't work, your best bet is to contact Developer Support, preferably with a sample that can reproduce the issue.

         

        I assume you are using the latest hotfix, there was an old issue that seemed related but its quite old and was resolved some time ago. 

         

         

      • 0
        Vincent
        Vincent answered on Feb 7, 2008 9:08 PM

        Thanks Darrell,

        Calling Bands(0).SortedColumns.Clear() on the grid solves the problem!  Actually, I tried to do it manually by getting an enumerator and setting them 1 by 1, that did not work either…

        I arm not sure if I am running the latest hotfix though.

        I can finally move on to something else. 

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Vincent
Favorites
0
Replies
4
Created On
Feb 07, 2008
Last Post
18 years ago

Suggested Discussions

Created by

Created on

Feb 7, 2008 9:08 PM

Last activity on

Feb 24, 2026 10:00 PM