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

Listview template failed to pass string to controller.

3 Answers 82 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Victor
Top achievements
Rank 1
Victor asked on 24 Dec 2015, 12:49 AM

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;
}

3 Answers, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 24 Dec 2015, 11:48 AM

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
0
Victor
Top achievements
Rank 1
answered on 25 Dec 2015, 01:51 AM

Dimiter,

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

 

Thanks again.

0
Dimiter Madjarov
Telerik team
answered on 25 Dec 2015, 06:53 AM

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
Tags
ListView
Asked by
Victor
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Victor
Top achievements
Rank 1
Share this question
or