网格视图中的数据列表 [英] Datalist in a gridview

查看:92
本文介绍了网格视图中的数据列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我将数据列表保存在gridview的一列中.而且,无论何时在gridview中单击键,都必须显示该特定行的数据列表.



这是代码:

Hi,
I have kept a datalist in a coloumn of a gridview. And when ever a key is clicked in the gridview the datalist must be shown for that particular row.



here is the code:

Dim row As GridViewRow = gv.SelectedRow
          Dim requirements As DataList = CType(row.Cells(2).FindControl("dl_respReq"), DataList)




我收到了空引用错误.

有人可以帮我吗

tahnkq




I am getting an null reference error.

please can someone help me

tahnkq

推荐答案

对象引用未设置为对象的实例

当您尝试使用属性或调用对象的方法为null时,会发生此错误.更多详细信息:此处 [Nothing.
Object reference not set to an instance of an object

This error happens when you try to use a property or call a method of an object that is null. More details: here[^]

A simple use of Visual studio DEBUGGER can tell you the object because of which it is happening. Just look at the stack trace and put a debugger on that line. Check the objects of that line and see if any one is null and you are trying to use that objects property. Handle the same.


For now, looks like row.Cells(2).FindControl("dl_respReq") is Nothing.


这篇关于网格视图中的数据列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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