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
2235
WebDataGrid Invalid DataKey
posted

Getting the following error when doing a databind on a webdatagrid

 

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

System.InvalidOperationException was caught

  Message=DataKeyField is invalid

  Source=Infragistics4.Web.v11.2

  StackTrace:

       at Infragistics.Web.UI.Framework.Data.DataSourceAdapter.Select(DataSourceSelectArguments arguments)

       at Infragistics.Web.UI.Framework.Data.DataSourceObjectView.ExecuteSelect(DataSourceSelectArguments arguments)

       at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)

       at System.Web.UI.WebControls.DataBoundControl.PerformSelect()

       at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()

       at Infragistics.Web.UI.GridControls.WebDataGrid.DataBind()

       at FedSelectWeb.Risk_Terms.LoadListData() in C:\Projects\FedSelect\FedSelectWeb\FedSelectWeb\Settings\sfrtblRiskTerms.aspx.vb:line 131

  InnerException:

 Private Sub LoadListData()
        Try
 
      
        Dim sString As String = Nothing
        MySession.RiskTermsList = GetRiskTermsList(sString)
        gGrid.ClearDataSource()
        gGrid.DataSource = MySession.RiskTermsList
        gGrid.DataBind()
        Dim selectedRows As SelectedRowCollection = gGrid.Behaviors.Selection.SelectedRows
            selectedRows.Add(gGrid.Rows(0))
            RecordCount(1, RiskTermsList.Count)
        Catch ex As Exception
 
        End Try
    End Sub

The RiskTermsList is a collection that contains 2 fields, a string and a integer.
The string field has been assigned as the datakeyfield.

I have other grids with strings as keyfields..

any ideas?