用户代码未处理无效的强制转换异常 [英] invalid cast exception was unhandled by user code

查看:76
本文介绍了用户代码未处理无效的强制转换异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我在制表符容器中的gridview中保留了按钮。虽然第一次加载其工作正常,但当我点击gridview中的下一页时它引发的错误为



无法转换类型'System.Web.UI的对象。 WebControls.ContentPlaceHolder'在以下行中键入'System.Web.UI.WebControls.GridViewRow'







GridViewRow gvr =(GridViewRow)((Control)e.CommandSource).NamingContainer;



我该怎么办?

Hi,

I have kept button inside gridview in tab container. While loading for first time its working fine but when i click next page in gridview its raising error as

"Unable to cast object of type 'System.Web.UI.WebControls.ContentPlaceHolder' to type 'System.Web.UI.WebControls.GridViewRow'"

in the following line,

GridViewRow gvr = (GridViewRow)((Control)e.CommandSource).NamingContainer;

what can i do?

推荐答案

检查互联网上提供的以下解决方案,我相信第一个链接可以解答您的问题。



http://stackoverflow.com/questions / 8919321 /无法投射对象的类型系统web-ui-webcontrols-gridview-in-asp-net [ ^ ]



出现错误 - 无法将'System.Web.UI.WebControls.ContentPlaceHolder'类型的对象强制转换为输入'System.Web.UI.WebControls.GridViewRow'。 [ ^ ]



但如果您的问题仍未解决,请使用一些代码段更新您的问题,以便我们可以进一步挖掘您的问题并找到准确的解决方案:)
Check following solutions available on internet and I believe the first link has the answer to your question.

http://stackoverflow.com/questions/8919321/unable-to-cast-object-of-type-system-web-ui-webcontrols-gridview-in-asp-net[^]

Error occured- "Unable to cast object of type 'System.Web.UI.WebControls.ContentPlaceHolder' to type 'System.Web.UI.WebControls.GridViewRow'."[^]

But if your problem is still not resolved, please update your question with some code snippet so that we can dig further to your problem and find the accurate solution :)


这篇关于用户代码未处理无效的强制转换异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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