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

[Solved] Problem with grid which uses detail view

3 Answers 158 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
saroj
Top achievements
Rank 1
saroj asked on 29 Mar 2012, 06:23 AM
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.

3 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 29 Mar 2012, 07:04 AM
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.
0
saroj
Top achievements
Rank 1
answered on 29 Mar 2012, 11:24 PM
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.

0
Petur Subev
Telerik team
answered on 30 Mar 2012, 11:39 AM
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.
Tags
General Discussions
Asked by
saroj
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
saroj
Top achievements
Rank 1
Share this question
or