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

[Solved] CRUD operation on hierarchy Grid

0 Answers 23 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.
Brijender
Top achievements
Rank 1
Brijender asked on 03 Nov 2011, 10:49 AM
Hi, we are making hierarchy Grid, it is binding successfully but when we try to execute the CRUD operation one the grid, only first node child  we able to perform the operation  successfully following scenario we are facing.. 

Insert :- if we try to execute the insert operation, on child the insert row is populated at the level of top level parent. but it is working fine in the case of first node and its child.

Edit :- on edit, the text boxes populated blank... and on cancel it is giving error

data is undefined
(function(c){var g=c.telerik;var a=/"\...",aggregates:"aggregates"}}})(jQuery);

but same working fine on first node and it children .

following is the my view code

  @(Html.Telerik().Grid<PAM.Brij2.ViewModels.Brij2Model>(Model.Data)
                    .Name("Brij2Grid")
                    .DataKeys(x =>
                    {
                        x.Add(y => y.Id).RouteKey("Id");
                    })

                    .Columns(columns =>
                    {
                        columns.Bound(x => x.Name)
                            .Width(200);
                        columns.Bound(x => x.Value)
                            .Width(200);
                        columns.Command(x =>
                        {
                            x.Edit().HtmlAttributes(new { style = "color:white; width:20px" });
                            x.Delete().HtmlAttributes(new { style = "color:white; width:20px" });
                        }).Width(200).Title("");
                    })
                    .DetailView(detailview=>detailview.Template(
                                                               @<text>
                                                               @(Html.Telerik().Grid(item.Detail)
                                                               .Name("firstgrid")
                                                               .DataKeys(x =>
                                                                {
                                                                    x.Add(y => y.Id).RouteKey("Id");
                                                                })
                                                               .Columns(columns=> {
                                                                                      columns.Bound(a => a.Name).Width(200);
                                                                                      columns.Bound(a => a.Value).Width(200);
                                                                                      columns.Command(x =>
                                                                                      {
                                                                                          x.Edit().HtmlAttributes(new { style = "color:white; width:20px" });
                                                                                          x.Delete().HtmlAttributes(new { style = "color:white; width:20px" });
                                                                                      }).Width(200).Title("");

                                                                        })  
                                                                            .Pageable(settings => settings.Total(10).PageSize(10).Position(GridPagerPosition.Both))
                                                                            .DataBinding(dataBinding => dataBinding.Ajax()
                                                                            .Select("FirstBrij2List", "Brij2")
                                                                                            .Insert("AddFirstBrij2Item", "Brij2", new { masterId = item.Id })
                                                                            .Update("UpdateFirstBrij2Item", "Brij2")
                                                                            .Delete("DeleteFirstBrij2Item", "Brij2"))
                                                                            .ToolBar(x => x.Insert().ImageHtmlAttributes(new { style = "margin-left:0" }).HtmlAttributes(new { style = "background-color:white; color:white" }))
                                                                            .Sortable()
                                                                            .Filterable()
                                                                            .EnableCustomBinding(true)
                                                                       )
                                             </text>
                                                               
                                    ))
                                   .RowAction(row =>
                                       {
                                         if (row.Index == 0)
                                              {
                                                row.DetailRow.Expanded = true;
                                              }
                                               else
                                                {
                                                    var requestKeys = Request.QueryString.Keys.Cast<string>();
                                                    var expanded = requestKeys.Any(key => key.StartsWith(row.DataItem.Id.ToString()));
                                                    row.DetailRow.Expanded = expanded;
                                                }
                                    })
                        .Pageable(settings => settings.Total(10).PageSize(10).Position(GridPagerPosition.Both))
                         .DataBinding(dataBinding => dataBinding.Ajax()
                         .Select("List", "Brij2")
                         .Insert("AddItem", "Brij2")
                         .Update("UpdateItem", "Brij2")
                         .Delete("DeleteItem", "Brij2"))
                         .ToolBar(x => x.Insert().ImageHtmlAttributes(new { style = "margin-left:0" }).HtmlAttributes(new { style = "background-color:white; color:white" }))
                     .Sortable()
                     .Filterable()
                    .EnableCustomBinding(true))




Please help

Regards
Brijender
Tags
Grid
Asked by
Brijender
Top achievements
Rank 1
Share this question
or