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

Problem in Master/Detail and editing mode

3 Answers 107 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.
Mazdak
Top achievements
Rank 1
Mazdak asked on 26 Apr 2011, 12:54 AM
I have Grid with Master/detail  binding, and it display fine, my details grid have edit button , the problem is when I click on one of edit buttons in detail grid the page postback and then Grid show collapsed, it means the grid which is in grid mode is not expanded and I should do it manually, how should I fix this?

Here is my Grid code:

<% Html.Telerik().Grid(Model)
        .Name("Grid")
        .DataKeys(keys => keys.Add(p => p.Id).RouteKey("Id"))
                .DataBinding(dataBinding => dataBinding.Server()
                                        .Insert("Insert", "Request")
                                        .Delete("Delete", "Request")
                                .Update("Editing", "Request")
                                
                                )
                .Columns(columns =>
                {
                    columns.Bound(p => p.Id).Width(40).Visible(true);
                    columns.Bound(p => p.Customer).Title("Customer").Width(180);
                    columns.Bound(p => p.Address).Width(180);
                    columns.Bound(p => p.State).Width(80);
                    columns.Bound(p => p.StartDate).Width(80);
                    columns.Bound(p => p.EndDate).Width(80);
                    columns.Bound(p => p.OptionA).Title("A").Width(40);
                    columns.Bound(p => p.OptionB).Title("B").Width(40);
                    columns.Bound(p => p.OptionC).Title("C").Width(40);
                    columns.Bound(p => p.OptionD).Title("D").Width(40);
                    columns.Bound(p => p.Description).Title("Additional Informaition").Width(140);
                    columns.Bound(c => c.Id).Template(c =>
                    {
     %>
     <%=Html.ActionLink("View Keywords", "Index", "Keyword", new { c.Id }, null)%>
     <%
                   }).Title("Tags").Visible(true);
                    

         columns.Command(commands =>
         {
             commands.Edit();
             commands.Delete();
         }).Title("Commands");

                })
                .DetailView(detailView => detailView.Template(e =>
       {
           %>
               <% Html.Telerik().Grid(e.CustomerRssChannelKeywords)
                      .DataKeys(keys => keys.Add(c => c.Id))
                      .DataBinding(dataBinding => dataBinding.Server()
            .Update("UpdateKeyword", "Request")
            .Delete("DeleteKeyword", "Request")
       )
                       .Name("CustomerRssChannelKeywords_" + e.Id)
                       .Columns(columns =>
                       {
                           columns.Bound(o => o.Id).Title("Id").Width(80).Visible(true);
                           columns.Bound(o => o.Phrase).Width(101);
                           columns.Bound(o => o.Option).Width(140);
                           columns.Command(commands =>
                           {
                               commands.Edit();
                               commands.Delete();
                           }).Width(200).Title("Commands");

                       })
                       .Sortable()
                       .Render();
               %>
           <%    
       }))

                .Editable(editing => editing.Mode(GridEditMode.InLine))
                .Pageable(paging => paging.Enabled(true).PageSize(10))
                .Scrollable(scrolling => scrolling.Height(300)).Sortable().Filterable().Render();
    %>

3 Answers, 1 is accepted

Sort by
0
David
Top achievements
Rank 1
answered on 17 Mar 2012, 08:57 AM
I have this exact issue and cannot figure out how stop the detail view from collapsing when i hit the edit button... or even the cancel button. Anyone have a solution for this?
0
MB
Top achievements
Rank 1
answered on 09 Apr 2012, 11:32 PM
I too have been struggling with this problem for days. This topic has been posted before elsewhere, and it remains unanswered. Am getting desperate...
0
Petur Subev
Telerik team
answered on 12 Apr 2012, 09:52 AM
Hello Michael,

You should implement logic to trace what is the parent master row item in which the detail Grid is being edited and save that row into the Session. This way in the RowAction method you could check whether or not to expand the detail view (similar logic is shown in this demo).

All the best,
Petur Subev
the Telerik team
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 Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
Tags
Grid
Asked by
Mazdak
Top achievements
Rank 1
Answers by
David
Top achievements
Rank 1
MB
Top achievements
Rank 1
Petur Subev
Telerik team
Share this question
or