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
60
WebDataGrid Errors
posted

Every time I try to perform any CRUD operation on my rows/columns I get an error that says :

Exception Details: Infragistics.Web.UI.GridControls.MissingRecordException: Requested record cannot be found by key.
Common Causes:
- The data key field(s) is being edited causing the record not to be found when trying to update.
- Not rebinding the grid when there are updates to be committed (assuming DataViewState is disabled in this case) – for instance if the grid is bound on !IsPostback.
- While a user is editing a particular row in the grid, another user deletes the record from the database. On posting back, the grid is rebound to the updated datasource which no longer contains the record, resulting in the exception.
- Changing completely or filtering the grid’s datasource before all CRUD operations are carried out – this is quite common when using other controls on the page to do this . This is partly due to the fact that control events such as SelectedIndexChanged for a dropdownlist or Click for a button fire before the updating events. Changing the grid’s source should in such cases be delayed for later (PreRender).

OR I get:

Error converting data type nvarchar to numeric.

***Steps I've take to try and fix the problem*****

1) I've changed all of the EnableAjax="False">

2)I've changed the AutoCrud to false

3) Made all of my jobId Int32's instead of decimals


**Heres a small snippet of one of the datagrids

<ig:WebDataGrid ID="WebDataGridJobs" runat="server" Height="500px" Width="100%" DataSourceID="SqlDataJobs" AutoGenerateColumns="False" DataKeyFields="JobID" EnableAjax="False">

<Columns>

<ig:BoundDataField DataFieldName="JobID" Key="JobID">

<Header Text="Job ID"></Header>

</ig:BoundDataField>

<ig:BoundDataField DataFieldName="JobTitle" Key="JobTitle">

<Header Text="Job Title"></Header>

</ig:BoundDataField>

<ig:BoundDataField DataFieldName="JobDescription" Key="JobDescription">

<Header Text="Job Description"></Header>

</ig:BoundDataField>

<ig:BoundDataField DataFieldName="Practice" Key="Practice">

<Header Text="Practice"></Header>

</ig:BoundDataField>

<ig:BoundDataField DataFieldName="EmploymentCategory" Key="EmploymentCategory">

<Header Text="Employment Category"></Header>

</ig:BoundDataField>

<ig:BoundDataField DataFieldName="CPR" Key="CPR">

<Header Text="CPR"></Header>

</ig:BoundDataField>

</Columns>

<EditorProviders>

<ig:TextBoxProvider ID="TextBoxProvider1">

<EditorControl ClientIDMode="Predictable"></EditorControl>

</ig:TextBoxProvider>

</EditorProviders>

<Behaviors>

<ig:Activation></ig:Activation>

<ig:EditingCore AutoCRUD="False">

<Behaviors>

<ig:CellEditing>

<EditModeActions MouseClick="Single" />

<ColumnSettings>

<ig:EditingColumnSetting ColumnKey="JobID" ReadOnly="true"></ig:EditingColumnSetting>

<ig:EditingColumnSetting ColumnKey="JobTitle" EditorID="TextBoxProvider1"></ig:EditingColumnSetting>

<ig:EditingColumnSetting EditorID="TextBoxProvider1" ColumnKey="JobDescription"></ig:EditingColumnSetting>

<ig:EditingColumnSetting EditorID="TextBoxProvider1" ColumnKey="Practice"></ig:EditingColumnSetting>

<ig:EditingColumnSetting EditorID="TextBoxProvider1" ColumnKey="EmploymentCategory"></ig:EditingColumnSetting>

<ig:EditingColumnSetting EditorID="TextBoxProvider1" ColumnKey="CPR"></ig:EditingColumnSetting>

</ColumnSettings>

</ig:CellEditing>

<ig:RowAdding Alignment="Top">

<ColumnSettings>

<ig:RowAddingColumnSetting EditorID="TextBoxProvider1" ColumnKey="JobTitle"></ig:RowAddingColumnSetting>

<ig:RowAddingColumnSetting EditorID="TextBoxProvider1" ColumnKey="JobDescription"></ig:RowAddingColumnSetting>

<ig:RowAddingColumnSetting EditorID="TextBoxProvider1" ColumnKey="Practice"></ig:RowAddingColumnSetting>

<ig:RowAddingColumnSetting EditorID="TextBoxProvider1" ColumnKey="EmploymentCategory"></ig:RowAddingColumnSetting>

<ig:RowAddingColumnSetting EditorID="TextBoxProvider1" ColumnKey="CPR"></ig:RowAddingColumnSetting>

</ColumnSettings>

<EditModeActions MouseClick="Single"></EditModeActions>

</ig:RowAdding>

<ig:RowDeleting></ig:RowDeleting>

</Behaviors>

</ig:EditingCore>

<ig:Selection CellClickAction="Row" RowSelectType="Single"></ig:Selection>

<ig:RowSelectors></ig:RowSelectors>

</Behaviors>

</ig:WebDataGrid>

Parents
  • 60
    posted

    **And the Code Behind***

    protected void Page_Load(object sender, EventArgs e)

    {

    if (!Page.IsPostBack)

    {

    //viewdata();

    WebDataGridJobs.DataBind();

    if(Session["dtValidator"] != null)

    {

    WebDataGridValidator.DataSource = Session["dtValidator"] as DataTable;

    WebDataGridValidator.DataBind();

    }

    }

    }

Reply Children