1

我在想是否有可能在 Telerik radgrid 上做 crud,并且数据是从 linq 到实体的。

我使用的是 edmx,然后我使用 linq 查询产生的数据设置了 Radgrid 的 DataSource。它是这样的:

DatabaseModel.Entities entities = new DatabaseModel.Entities();
RadGrid1.DataSource = from courses in entities.Courses
                      select new {
                          courses.CourseName,
                          courses.CourseCode,
                          courses.Description
                      };
RadGrid1.DataBind();

并且 Radgrid 是这样声明的:

<telerik:RadGrid ID="RadGrid1" runat="server"
    AllowAutomaticDeletes="true"  AllowAutomaticInserts="true" 
    AllowAutomaticUpdates="true" AllowPaging="True" 
    AutoGenerateDeleteColumn="True" EnableHeaderContextMenu="True" 
    AllowFilteringByColumn="True" AllowSorting="True" AutoGenerateEditColumn="True">
    <MasterTableView CommandItemDisplay="Top"  >
    </MasterTableView>
</telerik:RadGrid>

有什么办法可以通过这种方式编辑数据库内容?非常感谢。

4

1 回答 1

0

Telerik 网格支持使用数据源控件(LinqDataSource、EntityDataSource)作为 MS GridView 进行自动编辑。要执行手动 CRUD,请使用 NeedDataSource 绑定并挂钩服务器上的更新/插入/删除事件 - 请查看此演示以开始。

于 2010-02-26T08:18:29.687 回答