zoukankan      html  css  js  c++  java
  • 关于绑定自动生成的下拉式菜单的错误

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

  • 相关阅读:
    多维数组,转化为一维数组多种解决方案
    word-wrap与word-break的区别,以及无效情况
    重温前端基础之-js排序算法
    重温前端基础之-css浮动之怪异现象
    重温前端基础之-css浮动与清除浮动
    重温前端基础之-css盒模型
    C# 应用
    C# 应用
    C# 应用
    C# 应用
  • 原文地址:https://www.cnblogs.com/lgp/p/327973.html
Copyright © 2011-2022 走看看