GridView SelectedData键运行时错误. [英] GridView SelectedData key runtime error.

查看:65
本文介绍了GridView SelectedData键运行时错误.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您知道为什么此代码有错误吗?

字符串FolderID = grdCalls.SelectedDataKey [0] .ToString():-\

DO you know why this code have error

string FolderID = grdCalls.SelectedDataKey[0].ToString() :-\

推荐答案

字符串FolderID = grdCalls.SelectedDataKey [0] .ToString() "


它不会显示编译时错误,因为在编译时编译器不知道您是否使用了多个数据键.

"string FolderID = grdCalls.SelectedDataKey[0].ToString() "


It will not show you a Compile time error Because at a time of compilation compiler doesn''t know Either you have used multiple Datakeys or not.

i.e
DataKeyNames=CustID,ProductID



如果您使用了单个DataKeys



If you have used single DataKeys i.e

DataKeyNames = CustID


那么您就不需要在代码侧传递Index

如果您如上所述使用了多个键,则可以传递索引.

希望对您有所帮助.

如果有帮助,请 投票 接受答案 .


then you dont need to pass Index at codeside,

You can pass the index if you have used multiple keys as described above.

Hope it helps.

Please vote and Accept Answer if it Helped.


不确定,您可能会错过一个;也许?

如果不是那样,请发布错误消息并给我们一个提示...
Not sure, you could be missing a ; perhaps?

If that''s not it, please post the error message and give us a clue...


AFAIK .., SelectedDataKey 不支持索引. ,请删除索引,然后重试

通过以下链接..

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.selecteddatakey.aspx [
AFAIK.., SelectedDataKey does not supports the index., remove the index and try again

go through the below link..

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.selecteddatakey.aspx[^]

NOTE: Read the guidlines before posting a question, subject line should be in proper manner...


这篇关于GridView SelectedData键运行时错误.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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