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

Insert button on details view

1 Answer 18 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
AP
Top achievements
Rank 1
Veteran
AP asked on 11 Jan 2012, 12:04 PM
I've got a hierarchical master/details grid, which is fully editable. I've got editing and deleting working for both grids, but I can't display an insert button on the details grid, so inserts are only possible for the master table.

Everything else is working well, how can I add an insert button for the child records?

I'm using version 2011.3.1115.340 of the tools, and I'm using ajax binding

The view is:--

@using Telerik.Web.Mvc.UI;
 
@(Html.Telerik().Grid<MVC_Pricer.Models.PricingDefinition>()
    .Name("PricingDefinitionsGrid")
    .Editable(editing => editing.Mode(GridEditMode.PopUp))
    .ToolBar(commands => commands.Insert())
    .DataKeys(dataKeys => dataKeys.Add(o => o.ID))
    .Columns(columns=>
        {
            columns.Bound(o => o.ID).Title("ID");
            columns.Bound(o => o.DefinitionName).Title("Name");
            columns.Bound(o => o.SourceTable).Title("Source"); 
            columns.Bound(o => o.Active) .Title("Active");
            columns.Command(commands =>
            {
                commands.Edit().ButtonType(GridButtonType.Image);
                commands.Delete().ButtonType(GridButtonType.Image);
 
            });
            
             
        })
    .DetailView(details=>details.ClientTemplate(
        Html.Telerik().Grid<MVC_Pricer.Models.PricingFieldDefinition>()
        .Name("definitionFields_<#= ID #>")
        .Editable(editing => editing.Mode(GridEditMode.InLine))
            .ToolBar(tb => tb.Insert())
         
        .DataKeys(dataKeys => dataKeys.Add(o => o.ID))
        .Columns(columns=>
            {
                columns.Bound(o => o.SourceField);
                columns.Bound(o => o.DestinationField);
                columns.Command(commands=>
                {
                    commands.Edit().ButtonType(GridButtonType.Image);
                     
                    commands.Delete().ButtonType(GridButtonType.Image);
            });
                 
                 
            })
      .DataBinding(dataBinding=>dataBinding.Ajax()
                  .Select("DefinitionFieldBinding", "PricingDefinitions", new { DefinitionID = "<#= ID #>" })
                      .Update("UpdateField", "PricingDefinitions", new { DefinitionID = "<#= ID #>" })
                      .Delete("DeleteField", "PricingDefinitions", new { DefinitionID = "<#= ID #>" })
                      .Insert("InsertField", "PricingDefinitions", new { DefinitionID = "<#= ID #>" })
                  )
                   
      .Pageable()
      .Sortable()
      .ToHtmlString()
         
         
        ))
    .DataBinding(dataBinding => dataBinding.Ajax()
        .Select("DefinitionBinding", "PricingDefinitions")
        .Update("Update", "PricingDefinitions")
        .Insert("Insert", "PricingDefinitions")
        .Delete("Delete", "PricingDefinitions")
     )
    .Pageable()
    .Sortable()
    .Footer(false)
    .Filterable()
    .HtmlAttributes(new {style="width:650px;height:280px;"})
      
)

Thanks

1 Answer, 1 is accepted

Sort by
0
AP
Top achievements
Rank 1
Veteran
answered on 11 Jan 2012, 12:21 PM
It's very bizarre, I've just edited the master edit form (to accomodate a new field), and the child insert button is there!
Everything nows seems to work!


Tags
Grid
Asked by
AP
Top achievements
Rank 1
Veteran
Answers by
AP
Top achievements
Rank 1
Veteran
Share this question
or