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 DataFieldName="JobDescription" Key="JobDescription">
<Header Text="Job Description"></Header>
<ig:BoundDataField DataFieldName="Practice" Key="Practice">
<Header Text="Practice"></Header>
<ig:BoundDataField DataFieldName="EmploymentCategory" Key="EmploymentCategory">
<Header Text="Employment Category"></Header>
<ig:BoundDataField DataFieldName="CPR" Key="CPR">
<Header Text="CPR"></Header>
</Columns>
<EditorProviders>
<ig:TextBoxProvider ID="TextBoxProvider1">
<EditorControl ClientIDMode="Predictable"></EditorControl>
</ig:TextBoxProvider>
</EditorProviders>
<Behaviors>
<ig:Activation></ig:Activation>
<ig:EditingCore AutoCRUD="False">
<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">
<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>
<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>
</ig:WebDataGrid>
**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();
}
Hello Sam,
Thank you for posting in our forum.
I see that for the grid you’ve defined the data source used is a SqlDataSource.
Could you also share how that data source is defined? What are the Update/Delete/Insert parameters and the related Update/Delete/Insert Commands defined for it?
Could you describe a scenario in which you’re getting these errors?
Also could you let me know which version of the controls you’re currently using as well as the specific service release vesion?
I’m looking forward to your reply.
Best Regards,
Maya Kirova
Developer Support Engineer II
Infragistics, Inc.
http://www.infragistics.com/support
Attached is the entire aspx file. I am using Infragistics45.Web.v13.2, Version=13.2.20132.1003.
When I click inside a cell to make any changes and then click to a new cell the app explodes and throws an exception.
I’ve tested this on my side in a similar scenario where the NorthWind db is used.
I was not able to reproduce this issue on my side using based on the described scenario.
I have attached the sample project I used to test this. Please test this project on your PC; whether or not it works correctly may help indicate the nature of this problem.
If the project does not work correctly, this indicates either a problem possibly specific to your environment, or a difference in the DLL versions we are using.
If the project does show the product feature working correctly, this indicates a possible problem in the code of your application. It will help if you can provide a small, isolated sample application that demonstrates the behavior you are seeing.
Or, if this sample project is not an accurate demonstration of what you're trying to do, please feel free to modify it and send it back, or send a small sample project of your own if you have one.
Please let me know if I can provide any further assistance.
Hello Sam ,
I’m just following up to see if you’ve been able to resolve your issue. If you have any questions or concerns or if you need further assistance please let me know.
Developer Support Engineer