Insert id of the record in UrlAction

3 posts, 0 answers
  1. Harald
    Harald avatar
    54 posts
    Member since:
    Oct 2013

    Posted 16 Jul Link to this post

    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. Harald
    Harald avatar
    54 posts
    Member since:
    Oct 2013

    Posted 16 Jul Link to this post

    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.

     

  3. Harald
    Harald avatar
    54 posts
    Member since:
    Oct 2013

    Posted 16 Jul Link to this post

    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. 

Back to Top