This is a migrated thread and some comments may be shown as answers.

Client-side binding with <ItemTemplate>

3 Answers 148 Views
Grid
This is a migrated thread and some comments may be shown as answers.
ToltingColtAcres
Top achievements
Rank 2
Veteran
Iron
ToltingColtAcres asked on 19 Oct 2020, 12:55 AM

I have a client who uses currently uses RadGrids with <ItemTemplate> layouts to define rather complex record displays.

They would like these aspx pages converted to use a new ajax web service with client-side data binding.

I am having some difficulty finding the proper constructs to use to replicate the functionality they currently have. The <ClientItemTemplate> functionality doesn't seem to do it.

I did find this blog entry from 12 years ago:

https://www.telerik.com/blogs/telerik-radgrid-for-asp-net-ajax-q2-2008-client-side-edit-using-templates

This solution seems very bulky and, given the age of the article, likely outdated.

Is there a different approach/solution to use?

 

3 Answers, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 21 Oct 2020, 09:25 AM

Hi Michael,

Several years ago we introduced the Batch Edit functionality of the Grid which operates entirely on the clients side and supports edit item templates:
https://docs.telerik.com/devtools/aspnet-ajax/controls/grid/data-editing/edit-mode/batch-editing/working-with-templates

You can find useful information about the Batch Editing Templates and Specifics here:
https://www.telerik.com/support/kb/aspnet-ajax/grid/details/radgrid-batch-editing-templates-and-specifics

If the Batch Editing option is not applicable to your needs, you can take a look at the following KB article:
https://www.telerik.com/support/kb/aspnet-ajax/grid/details/using-templates-in-radgrid-with-client-side-binding

Regards,
Vessy
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
ToltingColtAcres
Top achievements
Rank 2
Veteran
Iron
answered on 21 Oct 2020, 01:28 PM

Hi Vessy,

Unfortunately neither the clientitemtemplate nor the batch editing feature is really what I'm looking for. There's very little "editing" involved in the grid in question.

Currently the grid has a multi-line display per record using the <ItemTemplate> functionality which then uses an <asp:Table> construct to display a sequence of rows and columns that contain text, date, integer and image data. Plus there are a couple of command action buttons to have the user choose one of several processes for each record. There's no real batch editing (the command buttons perform update functions on the record selected) and the clientitemtemplate seems to allow columnar formatting for the data, but in my case, I sort of have a multi-column, multi-row form for each record in the grid.

I'm not sure why the original programmer didn't use a radlistview, I'm almost of the thought I need to convert this to a radlistview rather than using a radgrid if there's client-side template functionality within that control.

0
Vessy
Telerik team
answered on 26 Oct 2020, 11:43 AM

Hi Michael,

Thanks a lot for the detailed update.

If you are not interested in the Edit functionality of RadGrid at all, using template columns with ItemTemplate is the way to go. In case you want to use the Grid's editing functionality, though, the Client-Side bound RadGrid can only be edited using BatchEdit mode.

Or you can use any other means to send AJAX requests to the server for inserting/updating records and bind the response to RadGrid:  https://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/insert-update-delete-client/defaultcs.aspx

Basically, you can do anything in the ItemTemplate. For convenience, I am attaching a sample project demonstrating a way to use RadGrid bound on Client-Side with Template Columns, which contain Server Controls. You can see that it will render without any problem but BatchEditing is the only built-in option to edit the Grid bound on client.

If none of these options are applicable to the target by you scenario, you may also consider switching to Kendo Grid that was designed completely for the client-side:

https://demos.telerik.com/kendo-ui/grid/index

 

Regards,
Vessy
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Grid
Asked by
ToltingColtAcres
Top achievements
Rank 2
Veteran
Iron
Answers by
Vessy
Telerik team
ToltingColtAcres
Top achievements
Rank 2
Veteran
Iron
Share this question
or