关于绑定自动生成的下拉式菜单的错误
2006-02-10 00:03
288 查看
最近在做一个自动生成控件并更新内容的东东,但是出现了意想不到的错误。
在初始化页面的时候,我绑定了生成的控件(下拉菜单),并选择其中一个做为选中
值,在更新中(button_click事件中),我又绑定了该控件,并选择相同的一个结果。
这时会出现错误:DROPDOWNLIST不能有多个值被选中。。。
绑定控件事件:
dim _drpDownList as DropDownList
_drpDownList = new DropDownList
_drpDownList.cssClass = "myDropDownList"
_drpDownList.Items.Add(New ListItem("content1","1"))
_drpDownList.Items.Add(New ListItem("content2","2"))
webutil.DropDownList.SelectByValue(_drpDownList,"1")
运行后,我发现两次调用绑定事件后,在这个下拉菜单中会有四个值出现,也就是说
重复出现绑定的值,然后,我又在NEW 语句下添加了一句:
_drpDownList.Items.Clear()
结果还是不行,后来把这句移到紧挨着添加项的一行,才可以正确执行,并且
没有重复的项出现,问题解决了,但是还是很让人费解。
*************************************************************************************
Server Error in '/' Application.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information.
Source Error:
在初始化页面的时候,我绑定了生成的控件(下拉菜单),并选择其中一个做为选中
值,在更新中(button_click事件中),我又绑定了该控件,并选择相同的一个结果。
这时会出现错误:DROPDOWNLIST不能有多个值被选中。。。
绑定控件事件:
dim _drpDownList as DropDownList
_drpDownList = new DropDownList
_drpDownList.cssClass = "myDropDownList"
_drpDownList.Items.Add(New ListItem("content1","1"))
_drpDownList.Items.Add(New ListItem("content2","2"))
webutil.DropDownList.SelectByValue(_drpDownList,"1")
运行后,我发现两次调用绑定事件后,在这个下拉菜单中会有四个值出现,也就是说
重复出现绑定的值,然后,我又在NEW 语句下添加了一句:
_drpDownList.Items.Clear()
结果还是不行,后来把这句移到紧挨着添加项的一行,才可以正确执行,并且
没有重复的项出现,问题解决了,但是还是很让人费解。
*************************************************************************************
Server Error in '/' Application.
Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.InvalidOperationException: Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
相关文章推荐
- eclipse关于安卓R文件自动生成的效率和错误问题
- 关于自动生成代码工具的构想
- MDWiki —— 一个可以自动生成左侧菜单并在线访问的工具
- 求助:怎样可以在下拉式菜单中列出数据库中所有关于该列的项?
- JAXB注解 java 关于xml的注解,自动生成xml文件
- SSH架构使用myeclipse自动生成的hbm的错误解决
- WPF DataGrid 绑定DataSet数据 自动生成行号
- 理解ButterKnife:自动生成绑定资源的代码
- 关于Oracle字段类型Date使用mybatis generator自动生成工具出现的查询日期只精确到年月日问题
- OpenRS插件开发之自动生成菜单
- JS自动生成三级级联菜单
- 关于Hibernate不能自动生成数据库表-POJO和映射文件正确但是访问对应表出错-的原因
- 关于asp网站生成系统的错误解决
- 关于后台生成的模板列的数据绑定问题
- 让myeclipse自动生成bean文件时遇到的错误解决方法
- 关于硕士毕业论文自动生成目录和参考文献上标的一些小技
- 自动生成Makefile时,关于Makefile.am编写
- DWR关于自动生成js的疑惑
- 关于angularJS绑定数据时自动转义html标签
- 关于android开发添加菜单XML文件之后无法在R.java中生成ID的问题