Hi Infragistics,
I have a Webdatagrid in an AJAX ModalPopup with a asp:DropDownList above the grid. What the user has to do is to select a picklist in the asp:DropDownList and the picklist items will be shown in the Webdatagrid. If the user select any of the picklist in the asp:DropDownList without doing any modification in the grid or modify something AND push the save button, there will have no problem. The issue appears when the user add a new row and add an item or modify a current row and choose another picklist without save anything. A message will be show:
Requested record cannot be found by key
Is there something I miss?
Thanks in advance!
Christ1
Hello Christ1,
Please assign a column key to DataKeyFields property, it must be unique for the grid data. The grid needs of such identifier in order to work correctly. Usually the primery key of the database table that the grid is boud to is used as DataKeyFields . Keep in mind that Sorting, Filtering, Selection, Editing, almost all grid behaviors(features), rely on unique datakeyfield.
Hope this heps.
Hi Radoslav,
Thank you for the fast reply, that was fast! Unfortunately, This doesn't fix my issue because I already do that in my code
I provide you my code to make it clearer:
<ig:webdatagrid id="wdgItemList" runat="server" autocrud="False" height="184px" width="870px" autogeneratecolumns="False" bordercolor="Black" borderwidth="1px" borderstyle="Solid" datakeyfields="PickListEntryID" enabledataviewstate="True"> <Columns> <ig:BoundDataField DataFieldName="PickListEntryID" Width="1px" Key="PickListEntryID" Hidden="true" DataType="System.Int32" > </ig:BoundDataField> <ig:BoundDataField DataFieldName="PickListID" Width="1px" Key="PickListID" Hidden="true" DataType="System.Int32"> </ig:BoundDataField> <ig:BoundDataField DataFieldName="TxtID" Width="1px" Key="TxtID" Hidden="true" DataType="System.String"> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Name" Width="97%" Key="Name" DataType="System.String"> <Header Text="Nom de l'item" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Description" Width="1px" Key="Description" Hidden="true" DataType="System.String"> </ig:BoundDataField> <ig:TemplateDataField Key="Delete" Width="16px"> <ItemTemplate> <asp:ImageButton ID="imgDelete" OnCommand="DeleteItem" OnClientClick='<%# BuildMessage(Eval("Name").toString)%>' CommandArgument='<%# Eval("PickListEntryID").toString%>' CommandName="Delete" ImageUrl="~/images/button_cancel.png" runat="server" Width="16px" Height="16px" ToolTip="Supprime un item de la liste" /> </ItemTemplate> </ig:TemplateDataField> </Columns> <Behaviors> <ig:Paging PagerAppearance="Bottom" PageSize="8" Enabled="false" /> <ig:Selection CellClickAction="Row" Enabled="true" /> <ig:EditingCore> <Behaviors> <ig:CellEditing EditModeActions-EnableF2="true" EditModeActions-EnableOnActive="true" EditModeActions-EnableOnKeyPress="true" EditModeActions-MouseClick="None" Enabled="true"> <EditModeActions EnableF2="true" EnableOnActive="True" EnableOnKeyPress="True" MouseClick="Single" /> </ig:CellEditing> </Behaviors> </ig:EditingCore> <ig:Sorting AscendingImageUrl="~/images/spacer.gif" DescendingImageUrl="~/images/spacer.gif"> <ColumnSettings> <ig:SortingColumnSetting ColumnKey="PickListEntryID" Sortable="False" /> <ig:SortingColumnSetting ColumnKey="PickListID" Sortable="False" /> <ig:SortingColumnSetting ColumnKey="TxtID" Sortable="False" /> <ig:SortingColumnSetting ColumnKey="Name" /> <ig:SortingColumnSetting ColumnKey="Description" Sortable="False" /> <ig:SortingColumnSetting ColumnKey="Delete" Sortable="False" /> </ColumnSettings> </ig:Sorting> <ig:Activation> <AutoPostBackFlags ActiveCellChanged="false" /> </ig:Activation> </Behaviors> </ig:webdatagrid>