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

Insert id of the record in UrlAction

2 Answers 431 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Harald
Top achievements
Rank 2
Harald asked on 16 Jul 2017, 03:59 PM

How can I specify the id of the record as an optional parameter in the UrlAction?

@model IEnumerable<proITdesk.Database.Models.Address>

...

<script type="text/x-kendo-tmpl" id="template">

    <a href='@Url.Action("Details", "Addresses", new { Id = "#=Id#" }.ToString())'>
        <div class="widget-primary">
            <h4 style="text-align:center">#:Name#</h4>
            <img src="@Url.Content("~/content/web/foods/")#:Id#.jpg" alt="#:Name# Image" />
        </div>
    </a>
</script>     

2 Answers, 1 is accepted

Sort by
0
Harald
Top achievements
Rank 2
answered on 16 Jul 2017, 04:23 PM

I have tested something:

@model IEnumerable<proITdesk.Database.Models.Address>

<script type="text/x-kendo-tmpl" id="template">
    
    <a href='@Url.Action("Details", "Addresses")/#:data.Id#'>
        <div class="widget-primary" style="width:250px;">
            <h4>#:Matchcode#</h4>
            <p>
            #:kendo.toString(Street)#<br />
            #:kendo.toString(Postcode)# 
            #:kendo.toString(City)#
            </p>
            <p>
                Telefon: 
                #:kendo.toString(Phone)#<br />
                Mobil: 
                #:kendo.toString(Mobile)#<br />
                #:kendo.toString(Mail)#<br />
                #:kendo.toString(Website)#
            </p>
        </div>
    </a>
</script>

@(Html.Kendo().ListView<proITdesk.Database.Models.Address>(Model)
    .Name("AddressListView")
    .TagName("div")
    .ClientTemplateId("template")
    .DataSource(dataSource => dataSource
        .Custom()
            .Schema(schema => schema
            .Model(model => model.Id("Id")))
        .PageSize(20)
     )
     .Pageable()
)

 

Now it works.

 

0
Harald
Top achievements
Rank 2
answered on 16 Jul 2017, 04:25 PM

I have tested something:

@model IEnumerable<proITdesk.Database.Models.Address>

d

<script type="text/x-kendo-tmpl" id="template">
    
    <a href='@Url.Action("Details", "Addresses")/#:data.Id#'>
        <div class="widget-primary" style="width:250px;">
            <h4>#:Matchcode#</h4>
            <p>
            #:kendo.toString(Street)#<br />
            #:kendo.toString(Postcode)# 
            #:kendo.toString(City)#
            </p>
            <p>
                Telefon: 
                #:kendo.toString(Phone)#<br />
                Mobil: 
                #:kendo.toString(Mobile)#<br />
                #:kendo.toString(Mail)#<br />
                #:kendo.toString(Website)#
            </p>
        </div>
    </a>
</script>

 

@(Html.Kendo().ListView<proITdesk.Database.Models.Address>(Model)
    .Name("AddressListView")
    .TagName("div")
    .ClientTemplateId("template")
    .DataSource(dataSource => dataSource
        .Custom()
            .Schema(schema => schema
            .Model(model => model.Id("Id")))
        .PageSize(20)
     )
     .Pageable()
)

Now it works. 

Tags
ListView
Asked by
Harald
Top achievements
Rank 2
Answers by
Harald
Top achievements
Rank 2
Share this question
or