【问题标题】:Radgrid inside editform settingsRadgrid在editform设置中
【发布时间】:2013-08-13 16:26:13
【问题描述】:

我在编辑表单中有一个 radgrid。我正在将 radgrid 绑定到 itemdatabound。

        int id= Convert.ToInt32(editForm.GetDataKeyValue("ID").ToString());
        RadGrid SummaryGrid = (RadGrid)item.FindControl("SummaryGrid");
        SummaryGrid.DataSource = spObj.Sp_GetProjectDetails(id);
        SummaryGrid.Visible = true;
        SummaryGrid.Enabled = true;
        SummaryGrid.DataBind();

问题是我只能编辑网格中的最后一行。我可以看到最后一行的数据绑定到内部网格。对于所有其他行,我得到以下错误。

“从 DataSource 中提取 DataKeyValues 时出现问题。请确保正确指定 DataKeyNames 并且指定的所有字段都存在于 DataSource 中。”

我的网格内部编辑:

     <telerik:RadGrid ID="SummaryGrid" runat="server" AllowPaging="True" PageSize="50"      AutoGenerateColumns="true"   Visible="true"   
 AllowMultiRowSelection="true" AllowSorting="true" Skin="Hay" Width ="500px" >
  <MasterTableView  DataKeyNames="ProjectID"  CommandItemDisplay="Top"      TableLayout="Fixed" Caption ="Position-Specific Network + Activity Code Totals"  Font-Bold="true" Font-Size="Small" Font-Names ="Ericsson Capital TT" >
   <PagerStyle Mode="NumericPages" Position="Top"></PagerStyle>
 <CommandItemSettings ShowAddNewRecordButton="false"/>
  </MasterTableView></telerik:RadGrid>
 </telerik:RadAjaxPanel>

这个问题阻碍了开发。有人可以对此提出任何帮助吗?任何帮助/想法都非常感谢。

谢谢

【问题讨论】:

标签: c#-4.0 telerik telerik-grid itemdatabound


【解决方案1】:

int id= Convert.ToInt32(editForm.GetDataKeyValue("ID").ToString());

这应该使用 ProjectID 而不是 ID。 ID 不是您在MasterTableView 中指定的数据键。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-03-11
    • 1970-01-01
    • 2013-03-27
    • 2023-04-11
    • 1970-01-01
    • 1970-01-01
    • 2015-08-04
    相关资源
    最近更新 更多