HI ,
I am using the Rad grid which is bind dynamically through code from code behind.
1.CRUD operation are performed on UpdateCommand,InsertCommand and DeleteCommand event.
2. I have another event lie need_datasource and itemdatabound event.
4.Paging is true.
When I click on Edit button on first page it works correctly. But when I go to Next or any other page apart from 1 page. it open the wrong record for editing. e.g I click on 2nd record on page 2 than it open the other recrord to edit.
Flow of event.
Click on Edit -> fires Need_Datasource event (which don't have RadGrid.Databind()).-> itemDataBound event is called -> it fetching the wrong datakey here. Below is the code of itemdatabound
if ((e.Item is GridEditableItem || e.Item is GridDataItem) && e.Item.IsInEditMode)
{
clsPEstimateLineItem objEstimatelineItem = new clsPEstimateLineItem();
GridEditableItem editForm = (GridEditableItem)e.Item;
objEstimatelineItem.LineItemId = clsFilter.IntNullFilter(item.GetDataKeyValue("LineItemId").ToString());
//objEstimatelineItem.LineItemId = clsFilter.IntNullFilter(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["LineItemId"]);
DataSet dslineItem = objBEstimateLineItem.GetEstimateLineItemById(objEstimatelineItem);
RadTextBox txtDescription = editForm.FindControl("txtDescription") as RadTextBox;
string Description = dslineItem.Tables[0].Rows[0].Field<string>("Description");
txtDescription.Text = Description.ToString();
}
Thanks
Ajay
I am using the Rad grid which is bind dynamically through code from code behind.
1.CRUD operation are performed on UpdateCommand,InsertCommand and DeleteCommand event.
2. I have another event lie need_datasource and itemdatabound event.
4.Paging is true.
When I click on Edit button on first page it works correctly. But when I go to Next or any other page apart from 1 page. it open the wrong record for editing. e.g I click on 2nd record on page 2 than it open the other recrord to edit.
Flow of event.
Click on Edit -> fires Need_Datasource event (which don't have RadGrid.Databind()).-> itemDataBound event is called -> it fetching the wrong datakey here. Below is the code of itemdatabound
if ((e.Item is GridEditableItem || e.Item is GridDataItem) && e.Item.IsInEditMode)
{
clsPEstimateLineItem objEstimatelineItem = new clsPEstimateLineItem();
GridEditableItem editForm = (GridEditableItem)e.Item;
objEstimatelineItem.LineItemId = clsFilter.IntNullFilter(item.GetDataKeyValue("LineItemId").ToString());
//objEstimatelineItem.LineItemId = clsFilter.IntNullFilter(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["LineItemId"]);
DataSet dslineItem = objBEstimateLineItem.GetEstimateLineItemById(objEstimatelineItem);
RadTextBox txtDescription = editForm.FindControl("txtDescription") as RadTextBox;
string Description = dslineItem.Tables[0].Rows[0].Field<string>("Description");
txtDescription.Text = Description.ToString();
}
Thanks
Ajay