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

Batch editing: Custom insert record routine

4 Answers 41 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bernd
Top achievements
Rank 2
Bernd asked on 05 Sep 2013, 10:07 AM
Hello all.

I want the user to select a master data record (in a RadWindow) and fill most of the grid fields from that selection. At the moment it is solved by having an additional button outside the grid. Technically okay and working. But it is quite ugly and the user won't understand why there are buttons (save and refresh) inside and one outside.

The solution "put all buttons outside the grid" is not the elegant way. So I studied the documentation http://www.telerik.com/help/aspnet-ajax/grid-batch-editing.html

But I found no way to intercept, modify or override the add new record buttons behaviour.

Is there really no elegant way to have a custon insert routine?

Kind regards
Bernd

4 Answers, 1 is accepted

Sort by
0
Angel Petrov
Telerik team
answered on 10 Sep 2013, 08:41 AM
Hello Bernd,

Since you have achieved the goal you are after by logic executed from buttons outside the grid. I suggest that you place them in the CommandItemTemplate. By following this approach you should be able to resolve the duplicating issue.

Please note that we do not recommend overriding the built-in logic of our controls as this may caused unexpected behavior.

Regards,
Angel Petrov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Bernd
Top achievements
Rank 2
answered on 11 Sep 2013, 01:14 AM
Hello Angel.

Thanks for the hint. It works. To use the bulit-in logic for the standard functions I use get_batchEditingManager(). Only one thing I was not able to solve. The parameter for the request is hardcoded.

Example request function
function SaveChangesButton_Clicked(sender, args){
    $find("<%= MatCompGrid.ClientID %>").get_batchEditingManager().saveChanges("MatCompGrid_ctl00");
}

<%= MatCompGrid.MasterTableView.ClientID %> returns "" and not the id. Which causes an exception.

How can I avoid the hardcoded id?

Thanks for your help.
Bernd
0
Accepted
Angel Petrov
Telerik team
answered on 13 Sep 2013, 02:22 PM
Hello Bernd,

In order to avoid the hard-coded value you can try the following:
function SaveChangesButton_Clicked(sender, args) {
            var grid = $find("<%= MatCompGrid.ClientID %>");
            grid.get_batchEditingManager().saveChanges(grid.get_masterTableView());
            }

Hope this helps you resolve the issue.

Regards,
Angel Petrov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Bernd
Top achievements
Rank 2
answered on 13 Sep 2013, 02:46 PM
This helped. Thank you.
Tags
Grid
Asked by
Bernd
Top achievements
Rank 2
Answers by
Angel Petrov
Telerik team
Bernd
Top achievements
Rank 2
Share this question
or