Click here to Skip to main content
15,922,325 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
protected void rad_grid_ItemDeleted(object sender, GridDeletedEventArgs e)
    {        
            if (e.Exception != null)
            {
                e.ExceptionHandled = true;

                DisplayMessage(true, "customer" + e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["CustomerID"] + "cannot be deleted:reason is" + e.Exception.Message);
            }
            else
            {
                DisplayMessage(false, "customer" + e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["CustomerID"] + "deleted");
            }
        }


i am using radgrid control
Posted
Updated 1-Jun-12 20:42pm
v2

Try debugging and stepping through your source code to get to the exact error.

In all probability, there is no row in OwnerTableView with datakey e.Item.ItemIndex value.
 
Share this answer
 
v2
Comments
VJ Reddy 4-Jun-12 19:57pm    
Good suggestion. 5!
Abhinav S 4-Jun-12 22:01pm    
Thank you VJ.
Hi,

e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["CustomerID"] is throwing the error.

e.Item.OwnerTableView.DataKeyValues has no element at index e.Item.ItemIndex

Happy Coding
:)
 
Share this answer
 
i have answered the same question but it was on gridview i am giving you that question link i hope it will work.

I get "error=Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index".[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900