关于绑定自动生成的下拉式菜单的错误

最近在做一个自动生成控件并更新内容的东东,但是出现了意想不到的错误。
在初始化页面的时候,我绑定了生成的控件(下拉菜单),并选择其中一个做为选中
值,在更新中(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.

转载于:https://www.cnblogs.com/lgp/archive/2006/02/10/327973.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值