Originally - UltraWebGrid v10.3The grid's DataSource was set in a function that was called from Page_Load. The grid had no bands or columns set up. The InitializeLayout function would move and hide columns. The InitializeRow function would update a row with a link for the text.
Currently - WebDataGrid v14.2I have changed the InitializeLayout to Init and left everything else the same. However, when I get into the Init function, it has yet to hit the Page_Load function and therefore errors out when trying to hide a column (as the DataSource has yet to be set or bound).
Having looked around, I found out that Init functions (everywhere) are called before the Page_Load function. Maybe the old InitializeRow and InitializeLayout weren't. Anyways, I then tried changing the Init function to the DataBound function, but now I'm having a different problem. Even though the grid is now bound and there are values in the DataSource, the columns remain 0.
Here is my markup:
<igwdg:WebDataGrid ID="wdgOffice" runat="server" TabIndex="101" EnableViewState="false"></igwdg:WebDataGrid>
Here's where the DataSource is being set:
wdgOffice.DataSource = OfficeTable 'dvOfficeList wdgOffice.DataMember = "Office" If (Not IsPostBack) Or (Not chkDeletedOffices.Checked) Then wdgOffice.DataBind() End If
As you can see by the attached picture, the DataSource is set, the grid says that it has columns, the grid says that it has 16 rows, yet it is throwing an error when trying to hide one of the columns. Am I missing something? I have a couple of other grids that act the same way, so this is quite important. Thanks.
Hello Jason,
Thank you for contacting Infragistics Developer Support!
Please provide a sample project replicating, so I can inspect it and help you resolving it.
I will be awaiting your feedback.
Thanks in advance!
I'm honestly not sure I'd be able to do that in a timely fashion. My whole days (and many evenings) are currently dedicated to upgrading from 10.3 to 14.2, and there are over 200 controls that need to be upgraded (grids - single level and hierarchical, date pickers, etc.). There is a due date of early March and I do not have much time to try and replicate this with manually created datasets and datatables. The main questions are:
1. Why am I getting an "Object reference not set to an instance of an object" error on a Column when the HasColumns is equal to True.
2. How can a DataSource be loaded, show 16 rows, yet have no columns?
3. What in the code (that you can see that I cannot) sets the HasColumns equal to True? Is it based off of the DataSet?
What I didn't show in the image is that the wdgOffice.Columns.Count is equal to 0. Me trying to recreate this manually would take too much time right now. Please try and help me as best as you can without me creating a sample project.