【问题标题】:crud with telerik radgrid and linq to entity使用telerik radgrid和linq to entity的crud
【发布时间】:2010-02-25 23:15:49
【问题描述】:

我在想是否可以在 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>

有什么办法可以这样编辑数据库内容吗?非常感谢。

【问题讨论】:

    标签: linq-to-entities telerik crud radgrid


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-06
      相关资源
      最近更新 更多