【问题标题】:"A field or property with the name'EncrypedStatusId' was not found on the selected data source."“在所选数据源上找不到名为‘EncrypedStatusId’的字段或属性。”
【发布时间】:2011-06-10 10:13:45
【问题描述】:

嗨, 我在 DataNavigateUrlFields 添加了一个新值 EncrypedStatusId 我收到错误 “在所选数据源上找不到名为‘EncrypedStatusId’的字段或属性。” 但我的列表确实有包含值的属性 EncrypedStatusId 如何解决这个问题? ASPX:

<asp:HyperLinkField HeaderText="Status" DataTextField="AppStatus" DataNavigateUrlFields="NavigateUrl,Id,EncrypedStatusId"
            SortExpression="AppStatus" DataNavigateUrlFormatString="{0}?Id={1}"></asp:HyperLinkField>
<asp:TemplateField>
     <ItemTemplate>
          <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("NavigateUrl","{0}").Replace(":", Server.UrlEncode(":")) %>'
                    DataTextField="AppStatus"></asp:HyperLink>
     </ItemTemplate>
</asp:TemplateField>

代码隐藏:

List<DTO> listDto;
IApplication engine;

engine = new Engine();
listDto = engine.ReadHistory(Session["UserID"].ToString());

this.dvHistory.DataSource = listDto;
this.dvHistory.DataBind();

【问题讨论】:

  • DataNavigateUrlFormatString 只有两个,你指定了 3 个,我不确定它是否可以接受
  • 也许EncrypedStatusId 无法访问,您可以发布相同的相关代码吗?
  • 顺便说一句:把HyperLink1中的DataTextField去掉,换上Text=''

标签: c# .net asp.net gridview


【解决方案1】:

gridview 属性中是否有 datakeynames=[EncrypedStatusId,...]

【讨论】:

    【解决方案2】:

    检查EncrypedStatusId 列是否存在于您的数据源中。

    【讨论】:

      猜你喜欢
      • 2014-07-15
      • 1970-01-01
      • 2016-10-23
      • 1970-01-01
      • 1970-01-01
      • 2012-07-01
      • 2015-10-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多