zoukankan      html  css  js  c++  java
  • System.NotSupportedException: Specified method is not supported(update xml in GridView)

    真是没有办法,因为服务器上面不能安装sql2005,现在做一个小的投票系统,只能用xml做数据库了,
    今天用xmldatasource绑定GridView,但是xmldatasource和其他的sqldatasource不一样,它不会自动的更改,删除数据,所以只能自己添加方法了,
    在用Gridview1_RowUpdated方法时,用了比较差劲的方法终于可以更改行数据了,可是当执行完成时
    会出现System.NotSupportedException: Specified method is not supported
    查看下面的错误详细信息
    [NotSupportedException: 不支持所指定的方法。]
    System.Web.UI.DataSourceView.ExecuteUpdate(IDictionary keys, IDictionary values, IDictionary oldValues) +28
    System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) +78
    System.Web.UI.WebControls.GridView.HandleUpdate(GridViewRow row, Int32 rowIndex, Boolean causesValidation) +1218
    System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +853
    System.Web.UI.WebControls.GridView.OnBubbleEvent(Object source, EventArgs e) +87
    System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
    System.Web.UI.WebControls.GridViewRow.OnBubbleEvent(Object source, EventArgs e) +117
    System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
    System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +86
    System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +153
    System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +172
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4921
    查了一下MSDN,xmldatasourceview.canUpdate的属性值是只读的值false,
    看来不能用GridView来更改,删除操作了,后来到网上查
    发现了http://forums.asp.net/1140181/ShowPost.aspx
    按照上面的做没有搞定
    不过新学习了cancel Control event: RemoveHandler GridView1.RowUpdating, AddressOf GridView1_RowUpdating
    加入代码里面也没有用
    后来只能用效率很低的方法Response.Redirect("self.aspx"),跳转到自己原来的页面
     终于搞定了
    真是没有办法
  • 相关阅读:
    滑动窗口与选择搜索
    R-CNN,SPP-NET, Fast-R-CNN,Faster-R-CNN, YOLO, SSD, R-FCN系列深度学习检测方法梳理
    GD和SGD区别
    AlexNet、VGG、NIN、GoogLeNet、ResNet
    目标检测中的precision,recall,AP,mAP计算详解
    转:图像分类、物体检测、物体分割、实例分割、语义分割
    卷积网络CNN中各种常见卷积过程
    卷积网络中的通道(Channel)和特征图
    人工智能之卷积神经网络(CNN)
    科技文献检索(一)——课程介绍及信息素养
  • 原文地址:https://www.cnblogs.com/xucanzhao/p/358121.html
Copyright © 2011-2022 走看看