Dear All,
based on some filter fields I want to access a database and show the corresponding data in a webhierarchicaldatagrid ( master / detail relation ).
It seems that something go wrong when I first load whole datasource and in a second request only load a selection of the whole datasource.
To be more specific :
1) first I leave all fields empty and load all data from the database into the whdg.-> I see all data, this is good
2) then I enter a specific value to search in the database-> I should see 1 master row with 3 detail rows, but it returns the error below.
For each query in the database I receive two datatables which join in a dataset. for each datatable I create the proper primary keys and afterwards I specify the relation.
But unfortunately I still receive this error message, does someone recognise this error and know how to solve it or what I'm doing wrong?
Table myTable doesn't contain a row with the specified PrimaryKey value
Description: An unhandled exception occurred during the execution of the current web request.
Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.RowNotInTableException: Table myTable doesn't contain a row with the specified PrimaryKey value
Source Error: An unhandled exception was generated during the execution of the current web request.
Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[RowNotInTableException: Table myTable doesn't contain a row with the specified PrimaryKey value] Infragistics.Web.UI.Framework.Data.DataSetNode..ctor(DataSet dataSet, String dataPath) +854 Infragistics.Web.UI.Framework.Data.DataSetDataBot.GetData(String dataPath) +85 Infragistics.Web.UI.Framework.Data.HierarchicalDataBot.GetHierarchicalData(IHierarchicalDataObject dataObject) +62 Infragistics.Web.UI.GridControls.HierarchicalGridBindingManager.GetHierarchicalEnumerable(IHierarchicalDataObject rootObject, Object dataSource) +289 Infragistics.Web.UI.GridControls.HierarchicalGridBindingManager.RowIslandRowsCount(ContainerGrid rowIsland) +229 Infragistics.Web.UI.GridControls.ContainerGrid.get_TotalRowCount() +192 Infragistics.Web.UI.GridControls.ContainerGrid.SaveViewState() +181 Infragistics.Web.UI.GridControls.ContainerGrid.System.Web.UI.IStateManager.SaveViewState() +33 Infragistics.Web.UI.Framework.ObjectCollection.SaveViewStateItems() +191 Infragistics.Web.UI.Framework.ObjectCollection.SaveViewState() +74 Infragistics.Web.UI.Framework.ObjectCollection.System.Web.UI.IStateManager.SaveViewState() +33 Infragistics.Web.UI.GridControls.ContainerGridRecord.SaveViewState() +136 Infragistics.Web.UI.Framework.ObjectBase.System.Web.UI.IStateManager.SaveViewState() +33 Infragistics.Web.UI.Framework.SparseObjectCollection.SaveViewStateItems() +197 Infragistics.Web.UI.Framework.ObjectCollection.SaveViewState() +74 Infragistics.Web.UI.Framework.ObjectCollection.System.Web.UI.IStateManager.SaveViewState() +33 Infragistics.Web.UI.GridControls.WebDataGrid.SaveViewState() +383 Infragistics.Web.UI.GridControls.ContainerGrid.SaveViewState() +277 Infragistics.Web.UI.GridControls.ContainerGrid.System.Web.UI.IStateManager.SaveViewState() +33 Infragistics.Web.UI.GridControls.WebHierarchicalDataGrid.SaveViewState() +406 System.Web.UI.Control.SaveViewStateRecursive(ViewStateMode inheritedMode) +50 System.Web.UI.Control.SaveViewStateRecursive(ViewStateMode inheritedMode) +148 System.Web.UI.Control.SaveViewStateRecursive(ViewStateMode inheritedMode) +148 System.Web.UI.Control.SaveViewStateRecursive(ViewStateMode inheritedMode) +148 System.Web.UI.Control.SaveViewStateRecursive(ViewStateMode inheritedMode) +148 System.Web.UI.Page.SaveAllState() +194 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2839
I refer this to fix my Editable WebDataGrid Issue(Batch Updating). My Issue is something strange. I get this error only when My WebDataGrid has more than 2 editable Rows. It runs smoothly when i update WebDataGrid upto 2 editable rows. It throws an error when it is trying to render WebDataGrid with more than 2 rows.. Importantly it does update the edited values successfully. WebDataGrid doesn't render with more than 2 rows again
Here is my HTML Mark up:
OnRowUpdating="wdgMarginsGrid_RowUpdating" StyleSetName="Default" EnableViewState="false" >
Please help me out.
Hi Kelvin Liu,
Thank you for your reply.
In your scenario disabling ViewState in conjunction with a search textbox/button would be a reasonable apporach. Just as some additional information, note that WebDataGrid is rebound to its datasource on every postback (except when EnableDataViewState is used), meaning that if the data comes from a database, a query is executed on every postback. Therefore using the build-in behavior would again give you up-to-date view of your data.
Please do not hesitate to contact me if any questions arise regarding this scenario.
Dear Petar,
Thank you for your reply on my question. Disabling the viewstate of my WebHierarchicalDataGrid works like you told me.
We pull our data from a Progress database using dll which connect to a Progress appserver. I'm aware of the filter possibilities in WebDataGrid as well as WebHierarchicalDataGrid, but that - according to me - only filters inside the datasource that is already bound to the control.
That means that my data is a snapshot of a sudden time in the past, while we are working with a live environment.
So... to obtain more realistic data from the Progress database, we have made our own filter that will repopulate the WHDG every time a user presses a (filter) button.
As I am a beginning user of Infragistics controls, I still have a lot to discover about the possibilities of the WHDG.
If you have a better solution for our situation, please let me know.
Hi KelvinLiu,
Thank you for posting in the community.
I suggest that you try disabling the viewstate of WebDataGrid as if you are filtering the grid's datasource from outside the grid (i.e. not by using the built-in filtering behavior), the grid itself may still be expecting the full non-filtered datasource to be loaded.
Please let me know if this helps.