hi,
I'm getting error "[MissingPrimaryKeyException]: Table doesn't have a primary key." after updated a cell in webdatagrid.
For your information the data has been updated into database and after re-populate the grid i'm getting "[MissingPrimaryKeyException]: Table doesn't have a primary key.".
Below are the error details:
Async request failed [MissingPrimaryKeyException]: Table doesn't have a primary key. at Infragistics.Web.UI.Framework.Data.DataViewDataSourceAdapter.Update(Object dataItem, IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) at Infragistics.Web.UI.Framework.Data.DataSourceObjectView.Update(Object dataItem, IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) at Infragistics.Web.UI.GridControls.EditingCore.OnAction(String actionType, Object id, Object value, Object tag) at Infragistics.Web.UI.GridControls.GridBehavior.Infragistics.Web.UI.GridControls.IGridBehavior.OnAction(String actionType, Object id, Object value, Object tag) at Infragistics.Web.UI.GridControls.GridBot.LoadAdditionalClientState(Object state) at Infragistics.Web.UI.Framework.RunBot.HandleRaisePostDataChangedEvent() at Infragistics.Web.UI.GridControls.GridBot.HandleRaisePostDataChangedEvent() at Infragistics.Web.UI.Framework.Data.FlatDataBoundControl.RaisePostDataChangedEvent() at System.Web.UI.Page.RaiseChangedEvents() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)[HttpUnhandledException]: Exception of type 'System.Web.HttpUnhandledException' was thrown. at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP.search_aspx.ProcessRequest(HttpContext context) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\ded915f3\b40162ce\App_Web_search.…
What shuold i set in order to resolve this error?
Hello wiley,
What type of DataSource do you bind the WebDataGrid to?
This is common exception when DataTable/DataSet is used
and no Primary key has not been set.
http://msdn.microsoft.com/es-es/library/system.data.datatable.primarykey.aspx
Please let me know if you need further assistance
Hi,
Yes, the data source is DataTable.
Everytime i re-bind it during page_load event, and it will caused the error after i update a cell.if i remove the rebind, then no javascript error.
Unfortunately, if not re-bind on every post back, the pagination will not working accordingly.
At the end, i do a work-around by coding the binding at PageIndexChanged event and it solved the problem.
Just wonder is there any "proper" solution on this issue?
setting only datasource of grid , but not rebinding.
Still giving error of primary key. Is there any solution other then setting primary key?
Please let us know if you need further assistance regarding this.
Yes, WebDataGrid requires setting DataSource on every post back.
I tried to reproduce the issue.
I am handling RowUpdating event in order to modify the datasource of the WebDataGrid .
I am not able to reproduce the issue.
Please refer to the sample attached and feel free to modify it in order to replicate the behavior.