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.

  • 相关阅读:
    C# Tips Written By Andrew Troelsen
    ASP.NET:性能与缓存
    New Feature In C# 2.0
    .NET Remoting中的通道注册
    通过应用程序域AppDomain加载和卸载程序集
    Some BrainTeaser in WinDev, Can you Solve them?
    ExtJs学习笔记(24)Drag/Drop拖动功能
    wap开发体会
    关于”System.ServiceModel.Activation.WebServiceHostFactory“与"<webHttp/>"以及RestFul/启用了Ajax的WCF服务
    验证码无刷新更换
  • 原文地址:https://www.cnblogs.com/lgp/p/327973.html
Copyright © 2011-2022 走看看