索引超出范围.必须为非负数,且小于删除行时的值 [英] index was out of range. must be non-negative and less than while deleting a row

查看:98
本文介绍了索引超出范围.必须为非负数,且小于删除行时的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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");
            }
        }



我正在使用radgrid control



i am using radgrid control

推荐答案

尝试调试并逐步查看源代码以获取确切的错误.

OwnerTableView中,没有任何行具有datakey e.Item.ItemIndex值.
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.




e.Item.OwnerTableView.DataKeyValues [e.Item.ItemIndex] ["CustomerID"]引发错误.

e.Item.OwnerTableView.DataKeyValues 在索引 e.Item.ItemIndex
上没有元素
快乐编码
:)
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
:)


我已经回答了相同的问题,但是它在gridview上,我正在向您提供该问题链接,我希望它可以正常工作.

我收到错误=索引已出范围之内.必须为非负数且小于集合的大小.参数名称:index. [
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".[^]


这篇关于索引超出范围.必须为非负数,且小于删除行时的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆