Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Telerik MVC Extensions (superseded) > General Discussions > Problem with grid which uses detail view

Not answered Problem with grid which uses detail view

Feed from this thread
  • saroj avatar

    Posted on Mar 29, 2012 (permalink)

    I have telerik grid --->(inside that grid) detailview ---> tabstrip ---> loadcontentfrom("another page"). so i have two different view pages one for grid and another for editing details in detail view.

    I have value in one column of grid view and to change(edit) that value and other details, I'm using detail view page.

    my problem is when i'm changing value in detailview it should be reflected in the grid as-well but it is not.
    I'm using mvc 3 with razor. 

    I'm trying to do something like below in detailview page but not getting success. 

     $('#SaveButtonId').click(function () {
            var $form = $(this).parent().parent().parent().parent().parent().parent().parent().parent().parent().parent().parent().html();
            var $target = $("[myId]", $form);
            // alert($target.attr("myId"))        
            //$target.attr("checked",false);
            $target.removeAttr('checked');
            //$target.removeAttr('disabled');
        });

    and my grid is like as below:

    @(Html.Telerik().Grid<ParametersSelectModel>()
                .Name("ParametersList")
                .Sortable(sorting => sorting.Enabled(true))
                        .Pageable(paging =>
                                paging.PageSize(15)
                                .Style(GridPagerStyles.NextPreviousAndNumeric)
                                .Position(GridPagerPosition.Bottom))
                .Footer(true)
                .DataBinding(dataBinding => dataBinding.Ajax().Select("_ParametersList", "Parameters"))
                .DataKeys(keys => keys.Add(p => p.PARAMETER_ID))
                .Filterable(filtering => filtering.Enabled(true))
                .Reorderable(reorder => reorder.Columns(true))
                .HtmlAttributes(new { style = "font-size: 10pt; margin-left:-13px; margin-right:-13px; margin-top: -4px; margin-bottom: -4px;" })
                .Columns(columns =>
                {
                    columns.Bound(p => p.NUMBER).Title("No.").Width(65).ReadOnly();
                    columns.Bound(p => p.MODULE).Title("Module").Width(207).ReadOnly();
                    columns.Bound(p => p.SHORT_DESCRIPT).Title("Description").Width(800).ClientTemplate("<dl title='<#= TOOLTIP #>' ><#= SHORT_DESCRIPT #></dl>");
                    columns.Bound(p => p.VALUE).Title("Value").ClientTemplate("<input type='checkbox' disabled='disabled' name='Active' <#= VALUE ? checked='checked' : '' #> myId='<#= NUMBER #>'/>")
                                               .Width(100).HtmlAttributes(new { @style = "text-align:center"});
                })

                .DetailView(details => details.ClientTemplate(
                 Html.Telerik().TabStrip()
                            .Name("TabStripchk_<#= NUMBER #>")
                        .HtmlAttributes(new { style = "font-size: 10pt; margin-left:-40px; margin-right:-10px; margin-top: -10px; border: 4px solid #f99f1c;" })
                        .SelectedIndex(0)
                        .Items(items =>
                            {
                                items.Add()
                                    .Text("Settings")
                                    .HtmlAttributes(new { style = "height: 28px;" })
                                    .LoadContentFrom(Url.Action("GeneralSettings", "Parameters", new { No = "<#= NUMBER #>", Chk = "<#= VALUE#>" }));
                            }).ToHtmlString()))
                                .ClientEvents(events => events
                                .OnDataBound("Flag_onDataBound")
                                //.OnDetailViewCollapse("Refresh_Gird")
                                ) )
    any solution for this please?
    Thanks in advance.

    Reply

  • Petur Subev Petur Subev admin's avatar

    Posted on Mar 29, 2012 (permalink)

    Hi Saroj,

    Generally speaking to apply the changes you have made to some of the items using the custom edit form inside the detail view you should rebind the Grid. To do so you could use the ajaxRequest method once your update has successfully completed.

    Kind Regards,
    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.

    Reply

  • saroj avatar

    Posted on Mar 29, 2012 (permalink)

    Hello Petur,

    I don't think this is the answer of my question.
    I want change in grid at the same time without collapsing the detail view. if i'll rebind the grid then of course it will show me the changed result but my expanded rows will all be collapsed.

    any idea for this?

    Thank you.

    Reply

  • Petur Subev Petur Subev admin's avatar

    Posted on Mar 30, 2012 (permalink)

    Hi again Saroj,

    There is no other way to update a particular row without rebinding the whole master Grid. What you can do to keep the detail view expanded is to save the indexes of the expanded rows and expand them using the expandRow method provided by the Grid API.

    Kind regards,
    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.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Telerik MVC Extensions (superseded) > General Discussions > Problem with grid which uses detail view