Manual CRUD operations with the Telerik RadGrid control

I have been working on a project lately that was already using the Telerik ASP.NET Rad Controls suite.  One of the new features was a fully editable web-grid, so I chose to use the existing ajax-enabled RadGrid control to speed my development.  I chose to use a 3rd party control, mostly due to time constraints since the project required a grid with inline-editing, full CRUD operations, plus custom column templates, all with heavy Ajax support to avoid postbacks and excessive page size.

I soon discovered, the Telerik controls are nice tool for simple uses where you can use asp.net DataSource controls and automatic databinding, but not so much if you need to get "fancy" with your implementation.  In my case I needed to do 2 things that cross over into the grey area where these controls excel.

First, I'm using an early 2.0 version of NetTiers for the DAL (with Service Layer implementation) with custom mods to the entities as the datasource,  and second, I'm doing some aggregate custom ItemTemplates that require custom data-binding.

This lead to extreme complexity in the implementation because, A) this version of NetTiers' had problems with properly generating CRUD operations for its EntityDataSource controls (NetTiers entities mapped onto a custom ObjectDataSource style control) which prevented me from using the declarative model, and B) the RadGrid control simply sucks if you cannot use automatic databinding and if you require custom databinding logic.

It would be great if I could upgrade NetTiers and/or Teleriki RadControls to the latest versions, but it wasnt possible in this situation, nor is it likely that this would have solved my problems.

Anyhow, all this discussion is basically just to share you this one link to a user-contributed example I found incredibly useful after 3 days of searching their forums, demos, and 3rd party blogs.   This example shows how to manually implement Insert/Update/Delete functionality within the RadGrid control by handling the events OnNeedDataSourceOnItemCommand, OnInsertCommand, OnUpdateCommand, and OnDeleteCommand:

http://www.telerik.com/community/code-library/subm...

The reason this link is important is because the Telerik website, with all of its dozens of examples, consistently shows very basic scenarios, even in samples labeled "advanced".  Also, not all of the API features are fully or well documented to help you figure this out on your own.

Hopefully this simple link (which should be promoted to Telerik's demos/samples page) will help someone else as much as it did me.

3 Comments

  • Just because you are not familiar with the RadGrid is no reason to claim it sucks when not using automatic databinding.

    In fact it works extremely well in that situation, I've lost count of how many times I've used a radgrid in an application, and I've rarely ever used automatic databinding. In fact I'm not sure I ever have used automatic databinding, as the scenario is generally too complex.

    OnItemCommand, OnInsertCommand, OnUpdateCommand, OnDeleteCommand. How much easier can they make it?

  • I understand what you are saying, and if I failed to say it, I do think that the RadGrid is a very powerful and well-built control for the most part. Also the Telerik site is very nice and the examples and demos they provide are great even if lacking in permutation of common scenarios.

    What I meant by saying it sucks, was really that the experience of a developer trying to use the control for the first time is what sucked.

    I have no doubt that now that I have done it once, it will be easier the next time. This is true with most things. However, the Telerik examples and documentation on how to implement manual databinding was seriously lacking - so were other areas such as how to aggregate various other Telerik controls within column templates.

    So, my point was that the grid is advertised as a simple drop-in solution, but that really only applies to the more basic databinding scenarios. Once you go off the reservation a bit, all bets are off. Luckily they do have support, forums, and a good community to help solve your problems if you have the time to use them.

    Maybe I just expected too much...

  • Thanks. Just saved me several hours.....

Comments have been disabled for this content.