开发者

MongoDB/C# and Telerik Ajax RadGrid

开发者 https://www.devze.com 2023-02-13 23:47 出处:网络
Can some expert propose a way to use Telerik RadControls Ajax Grids and MongoDb C# Official driver to manage a simple Grid table Create/Update/Delete methods. The object is managing a simple Table dat

Can some expert propose a way to use Telerik RadControls Ajax Grids and MongoDb C# Official driver to manage a simple Grid table Create/Update/Delete methods. The object is managing a simple Table data from a web control.

Thanks.


  1. Use FindAs to load some collection from database(probably you will also use skip, limit, and SetSor tOrder).
  2. I am not familiar with telerik-grid at all but it seems to me that as usual grid, telerik grid has some property like DataSource. So you can bind data using DataSource property.
  3. For the update/delete/insert methods i suppose telerik grid has some kind of events(like on item insert, delete). And you can easy create methods thats will be update/delete/insert in mongo.

In abstract process will looks like:

var items = mongoCollection.FindAs<Type>(Query.EQ("someProperty", "someValue"))
           .SetSortOrder("orderField").SetLimit(100).Skip(10);

telerikGrid.DataSource = items;
telerikGrid.DataBind();

....

telerikGrid_OnItemDelete(object sender, SomeEventArgs e)
{
   var id = e. //get parameter from args
   ..
   mongoCollection.Remove(Query.EQ("_id", id));
}

Also i suggest you ask question about telerik grid( How to bind list of data to telerik grid?), or take a look into telerik documentation (i suppose that telerik has perfect documentation). Or even ask telerik community.

Hope my 'abstract' answer somehow help you.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号