我在想是否有可能在 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>
有什么办法可以通过这种方式编辑数据库内容?非常感谢。