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

BatchEdit and CommandItemTemplate

5 Answers 69 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Frank
Top achievements
Rank 2
Frank asked on 27 Jul 2014, 08:24 PM
Hi

When I have a button (btnSaveAll) in a Custom commandbar using CommandItemTemplate, to Save all the updated records, the OnItemCommand event fires, but not the OnBatchUpdating event. How can the OnBatchUpdating event being triggered when the btnSaveAll button is clicked?

Best regards,

Frank

5 Answers, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 30 Jul 2014, 10:56 AM
Hello Frank,

When you are using CommandItemTemplate with enabled Batch editing functionality, in order to fire some of the batch editing commands you will need to apply custom logic on client-side, where using the Batch Editing Manager you could perform the commands you need.

For your convenience I have prepared a sample page, where I have implemented a "Save Changes" button and a "Add New Record" button. Please examine the attached files and see if this approach meets your exact requirements.

I hope this helps.


Regards,
Konstantin Dikov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Frank
Top achievements
Rank 2
answered on 01 Aug 2014, 10:26 PM
Thank you Konstantin,
your example works indeed.
In my project still the radgrid_onItemCommand event is triggered, not the onBatchEditCommand.
I still need to find out why that is happening, by comparing your and my page, but maybe you have an idea where to look?
Cheers
Frank
0
Maria Ilieva
Telerik team
answered on 06 Aug 2014, 03:08 PM
Hello Frank,

Ac it appears that some specifics in your code a leading to the problematic behavior I would kindly ask you to open a regular support ticket and send us runnable version of your application. Thus we will be able to test it locally and determine what exactly is the difference between both applications.

Regards,
Maria Ilieva
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Frank
Top achievements
Rank 2
answered on 22 Aug 2014, 01:06 PM
Hi Konstantin,

Thank you for your reply. I was on holiday, that's why I didn't react earlier.
Your example project works indeed.

Still I have some questions:
- When I use in your example the asp-linkbuttons in the commandbar instead of RadButtons to save the updates, the OnItemCommand fires, not the onBatchUpdating event. How to make this work for a linkbuttons?
- When I use a GridTemplateColumn, with in the EditItemTemplate a dropdown listbox, and in the ItemTemplate a label, both pointing to the same data field, how can I have the dropdown listbox filled with the available options. I used to do that on the ItemDataBound event (when item is GridEditableItem and item.IsInEditMode), but obviously this event is not fired.

Best regards,
Frank
0
Maria Ilieva
Telerik team
answered on 27 Aug 2014, 10:16 AM
Hi Frank,

1. Note that when using a LinkButton you should prevent the default behavior in order to stop the regular postback form the button and force the batch editing post. See the example below, which demonstrates how the client event should be attached:
<CommandItemTemplate>
                        <asp:LinkButton runat="server" ID="LinkButton1" Text="Save changes" OnClientClick="saveGridChanges()"></asp:LinkButton>
</CommandItemTemplate>

2. In the current implementation of the batch edit mode data-binding expression are not allowed in the EditItemTemplate. The mode is designed in such way that it will automatically fill the value in the input element. If however you have more than one control in the template, things should be handled manually like explained in this help article.
Another approach is to directly use GridDropDownColumn which should cover your requirements.

Regards,
Maria Ilieva
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Frank
Top achievements
Rank 2
Answers by
Konstantin Dikov
Telerik team
Frank
Top achievements
Rank 2
Maria Ilieva
Telerik team
Share this question
or