Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
580
WHDG - After Row_Updated event, got error - Table doesn't have primary key
posted

Hi,

I am using WHDG. I am allowing end user to update the cell value on the WHDG.

I using Dataset for binding the WHDG. sorting, pagination etc functionality is working find on binded grid. Now When user modify any cell value and after navigate to another page of the grid,

WHDG fires Page_Load, Row_Updating and Row_Updated event, as soon as it complete the execution of 'Row_Updated' event I got following Error,

Error Message: Table doesn't have a primary key.

Error Source: Infragistics4.Web.v13.1

Error StackTrace:    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.GridControls.ContainerGridBot.LoadAdditionalClientState(Object state)    at Infragistics.Web.UI.Framework.RunBot.HandleRaisePostDataChangedEvent()    at Infragistics.Web.UI.GridControls.GridBot.HandleRaisePostDataChangedEvent()    at Infragistics.Web.UI.GridControls.ContainerGrid.RaisePostDataChangedEvent()    at System.Web.UI.Page.RaiseChangedEvents()    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Can any one help me, how to resolve this issue? Is any configuration or code am I missing???

Thanks,

Yogesh Shah

  • 20255
    Offline posted

    Hello Yogesh,

    I'm just checking if you have resolved your issue. If there is anything that I could help you with, please let me know.

  • 20255
    Suggested Answer
    Offline posted

    Hello Yogesh,

     Thank you for posting in our community!

     Could you please check carefully the structure of your DataSet, I think that you are not defined correctly PrimaryKeys for your tables. I have create a sample that is showing how to bind WHDG to DataSet, please have a look.

    Code snippet:

            DataSet ds = new DataSet();
            DataTable Parent = new DataTable();
            Parent.TableName = "Parent";
            DataTable Child = new DataTable();
            Child.TableName = "Child";

            Parent.Columns.Add("ID", typeof(System.Int32));
            Parent.Columns.Add("Name");
            Parent.Columns.Add("Test");
      
            DataColumn[] col = new DataColumn[1];
            col[0] = Parent.Columns["ID"];
            Parent.PrimaryKey = col;

            DataRow row = Parent.NewRow();
            row.SetField<int>("ID", 0);
            row.SetField<string>("Name", "Alice");
            row.SetField<string>("Test", "test1");
            Parent.Rows.Add(row);

     If you have any further question, contact me!

    WHDG.zip