zoukankan      html  css  js  c++  java
  • asp.net 异常:"DataBinding: 'System.Data.DataRowView'

    gridview帮定数据之后,出现

    System.Web.HttpException was unhandled by user code
      Message="DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'Topic'."
      Source="System.Web"
      ErrorCode=-2147467259
      StackTrace:
           at System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName)
           at System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding)
           at System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data)
           at System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable data)
           at System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data)
           at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)
           at System.Web.UI.WebControls.DataBoundControl.PerformSelect()
           at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
           at System.Web.UI.WebControls.GridView.DataBind()
           at TopicList.SetBind() in e:\SOLUTION\Forum\TopicList.aspx.cs:line 34
           at TopicList.Page_Load(Object sender, EventArgs e) in e:\SOLUTION\Forum\TopicList.aspx.cs:line 20
           at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
           at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
           at System.Web.UI.Control.OnLoad(EventArgs e)
           at System.Web.UI.Control.LoadRecursive()
           at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

    上面就是trace内容,我就不知道那个Topic是哪里的,最后在属性窗口的DataKeyNames就是Gridview的主键里发现了Topic,可能当时忘记了,改掉,重试,通过。

  • 相关阅读:
    爬虫基础 2.1 http原理
    爬虫基础 2.1 http原理
    3.29上午
    3.28
    3.27下午
    3.27上午
    3.24上午
    3.23下午
    3.23上午
    3.22上午
  • 原文地址:https://www.cnblogs.com/bnuvincent/p/1524916.html
Copyright © 2011-2022 走看看