Listview template failed to pass string to controller.

4 posts, 0 answers
  1. Victor
    Victor avatar
    23 posts
    Member since:
    Feb 2015

    Posted 23 Dec 2015 Link to this post

    can someone tell me why this is not working? I am trying to puss the ID of the video to GetVideoDuration().

    <script type="text/x-kendo-template" id="template">
     
       <div class="duration"
            @{string VID = "VID";}                                                            
            @VID.Replace("Vimeo_ID", "${VID}")
            @MultimediaController.GetVideoDuration(VID)
        </div>
     
    </script>

    Second line display the correct VID on every record. But when  GetVideoDuration() is getting executed the value passed is VID string not the actual number.

    multimedia controller.

    public static string GetVideoDuration(string VID)
    {
                string strDuration = string.Empty;
    }

  2. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2159 posts

    Posted 24 Dec 2015 Link to this post

    Hello Victor,

    The Kendo template is evaluated on the client side, while the used razor invocation is evaluated on the server side instead. This is why the current implementation will not work and should be reconsidered. For example you could construct a ViewModel for the ListView that will include the video duration directly in it, so you could reference it in the template.

    Regards,
    Dimiter Madjarov
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Victor
    Victor avatar
    23 posts
    Member since:
    Feb 2015

    Posted 24 Dec 2015 Link to this post

    Dimiter,

    Thanks for responding to me. I have realized it after sometime. I have done it similarly to your suggestion. 

     

    Thanks again.

  5. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2159 posts

    Posted 25 Dec 2015 Link to this post

    Hello Victor,

    Thank you for the update.

    I wish you happy holidays!

    Regards,
    Dimiter Madjarov
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
Back to Top
UI for ASP.NET MVC is VS 2017 Ready