Hi,
I have some problem with DataKey values. I used to bind certain template controls of the grid based on the datakey values of the grid. I only need to bind when the grid is in edit mode. So i used ItemDataBound event and check the IsEditMode mtthod to bind the details based on the DataKeyvalues. Every thing is working fine it is getting the records based on primarykey Datakey value.
But the problem occures when i try to add new record. When i click the Insert button it goes to ItemDatabound event and check the IsEditMode but throws error when comes to this line of code,
I have some problem with DataKey values. I used to bind certain template controls of the grid based on the datakey values of the grid. I only need to bind when the grid is in edit mode. So i used ItemDataBound event and check the IsEditMode mtthod to bind the details based on the DataKeyvalues. Every thing is working fine it is getting the records based on primarykey Datakey value.
But the problem occures when i try to add new record. When i click the Insert button it goes to ItemDatabound event and check the IsEditMode but throws error when comes to this line of code,
EID = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex][
"EID"].ToString();
But i need the above code for binding data when in EditMode, but causes an null error when click Insert Button.
So help me to solve this issue,
-Thanks