简体   繁体   English

无法在Telerik RadGridView上隐式转换类型

[英]Cannot implicitly convert type on Telerik RadGridView

Please take a look at below codes: 请看下面的代码:

private void testing(object sender,MouseEventArgs e){
    GridViewCellInfo testData = (sender as RadGridView).CurrentCell;
}

From the above code, intellisense giving me error as below 从上面的代码中,Intellisense给我错误如下

Cannot implicitly convert type 'Telerik.Windows.Controls.GridView.GridViewCell' 
to 'Telerik.Windows.Controls.GridViewCellInfo'

According the this link RadGridView detect CellClick event button , I'm suppose to be able to write the above code. 根据此链接RadGridView检测CellClick事件按钮 ,我想能够编写以上代码。 So what went wrong? 那么出了什么问题?

Well it looks like CurrentCell is not returning what you think it will. 好吧,看起来CurrentCell没有返回您认为的样子。 Try only looking for a GridViewCell and see if that will accomplish what you need. 尝试仅查找GridViewCell ,看看是否GridViewCell您的需求。

private void testing(object sender,MouseEventArgs e){
    GridViewCell testData = (sender as RadGridView).CurrentCell;
}
GridViewCellInfo testData = (sender as RadGridView).Cells[*number of cell*];

请参阅telerik网站中的示例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM