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
1140
Reg: Requested record cannot be found by key.
posted

Hi ,

    In the webdatagrid, When I am changing a value in the one cell i am asking yes or no option. when I am clicking any option, it is updated using RowUpdating event, after that when I am refreshing the grid it is telling as "Requested record cannot be found by key". The JavaScript code is follows 

var StatusValue;

function WebDataGrid_EnteredEditMode(sender,evntArgs)
{
var grid=$find('<%=WebDataGrid.ClientID%>');
var row = evntArgs.getCell().get_row();
var currCell = evntArgs.getCell();
StatusValue=row.get_cellByColumnKey("Key_STATUS").get_value();
}

function WebDataGrid_ExitedEditMode(sender, evntArgs)
{
var grid=$find('<%=WebDataGrid.ClientID%>');
var row = evntArgs.getCell().get_row();
var currCell = evntArgs.getCell();
if(evntArgs.getCell().get_column().get_key()=="Key_STATUS")
{
var a=row.get_cellByColumnKey("Key_STATUS").get_value()
var StatusText;
var retVal = window.confirm("Are do you want to change the value?");
if( retVal != true )
{
if(StatusValue==1)
{
StatusText="Live";
}
else
if(StatusValue==2)
{
StatusText="Won";
}
else
if(StatusValue==3)
{
StatusText="Lost";
}
else
if(StatusValue==4)
{
StatusText="Cancelled";
}
row.get_cellByColumnKey("Key_STATUS").set_text(StatusText);
document.getElementById('<%=hidden.ClientID%>').value=StatusValue;
}
else
{
//Saving the database immediately. So, we are calling here WebDataGrid_RowUpdating server side event.
document.getElementById('<%=hidden.ClientID%>').value="";
}
var editingCore = grid.get_behaviors().get_editingCore();
editingCore.commit();
__doPostBack("<%= WebDataGrid.ClientID %>", "");

}
}

Please do the needful.