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

[Solved] ActionLink with RouteValue from ParentRow in Client Detail Template

1 Answer 96 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.
JULIA
Top achievements
Rank 1
JULIA asked on 16 Aug 2010, 12:22 PM
Hello,

i have the following grid.

<%= Html.Telerik().Grid<PersonViewModel>(   )
        .Name( "Grid" )
        .DataKeys( keys => keys.Add( p => p.PersonId ).RouteKey( "physicianId" ) )
            .Columns( columns =>
            {
                columns.Bound( c => c.PersonId ).Width(80);
                columns.Bound( c => c.FullName ).Width( 250 );
                columns.Bound( c => c.Email ).Width( 250 );
            } )
            .DetailView( details => details.ClientTemplate(
                        Html.Telerik().TabStrip().Name( "TabStrip_<#= PersonId #>" )
                        .SelectedIndex( 0 )
                        .Items( items =>
                        {
                            items.Add().Text( "Zugeordnet" ).Content(
                                Html.Telerik().Grid<PersonViewModel>()
                                .Name( "Assigned_<#= PersonId #>" )
                                .Columns( columns =>
                                {
                                    columns.Bound( c => c.PersonId ).Width( 80 );
                                    columns.Bound( c => c.FullName ).Width( 250 );
                                    columns.Bound( c => c.Email ).Width( 250 );
                                    columns.Bound( c => c.PersonId ).Title( string.Empty ).ClientTemplate(
                                        Ajax.ActionLink( "Zuordnung aufheben", "Assign", "MyConroller",
                                            new { physicianId = "Parent.PersonId", // PersonId from Parentgrid
documentalistId = "<#= PersonId #>", // PersonId from Grid in DetailTemplate
isAssigned = false },
                                            new AjaxOptions { OnSuccess = "rebind" },
                                            new { @class = "t-button t-state-default" } ).ToString()
                                    ).Width( 80 );
                                } )
                                .DataBinding( dataBinding => dataBinding.Ajax()
                                    .Select( "_Action", "MyConroller", new { id = "<#= PersonId #>" } ) )
                                    .Pageable()
                                    .ToHtmlString() );
                        }).ToHtmlString()
                                ))
            .EnableCustomBinding( true )
            .Pageable( p => { p.Total( ViewData["total"] != null ? ( int )ViewData["total"] : 0 ); } )
            .Sortable()
            .DataBinding( dataBinding => dataBinding.Ajax().Select( "_MySelect", "MyConroller" ))
    %>

Please look at the following line:
new { physicianId = "Parent.PersonId"

How can i set the PersonId of the ParentRow? Both grids use the same ViewModel therefore the Id properties are named PersonId.

Regards,
Timo

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 16 Aug 2010, 12:58 PM
Hi Timo,

You can expose a property called ParentPersonID for the PersonViewModel object and use it like <#= PersonID #>

Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
JULIA
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or