@{ Html.RenderPartial(MVC.Shared.Views.Partials.CameraTagVideoPlayer, new CameraTagVideoPlayerViewModel("applicationVideo", "xxx")); }
我想用特定的敲除数据绑定替换“xxx”。如何在html renderPartial中替换字符串?
例如,
<span data-bind="text: application.applicationKey"></span>
给了我一个人的applicationKey。我想把这个键放在RenderPartial里面来播放视频。有没有办法做到这一点?
编辑:
public static class Partials
{
public readonly static string _CurvedSelector = "~/Views/Shared/Partials/_CurvedSelector.cshtml";
public readonly static string SelectMonthOptions = "~/Views/Shared/Partials/SelectMonthOptions.cshtml";
public readonly static string SelectStateOptions = "~/Views/Shared/Partials/SelectStateOptions.cshtml";
public readonly static string SelectYearOptions = "~/Views/Shared/Partials/SelectYearOptions.cshtml";
public readonly static string ToggleButton = "~/Views/Shared/Partials/ToggleButton.cshtml";
public readonly static string CameraTagVideoPlayer = "~/Views/Shared/Partials/CameraTagVideoPlayer.cshtml";
public readonly static string CreditCardFormFields = "~/Views/Shared/Partials/CreditCardFormFields.cshtml";
public readonly static string CreditCardJavascript = "~/Views/Shared/Partials/CreditCardJavascript.cshtml";
public readonly static string AntiBotFormFields = "~/Views/Shared/Partials/AntiBotFormFields.cshtml";
public readonly static string ExitModal = "~/Views/Shared/Partials/ExitModal.cshtml";
}
cameratagvideoplayer.html:
@model CameraTagVideoPlayerViewModel
@{
// CameraTag video security
long expiration = Utilities.ToUnixTimestamp(DateTime.UtcNow.AddMinutes(30)); // can be no more than 1 hour
string signature = Utilities.CreateTokenHmacSha1(expiration.ToString(), AppSettings.Current.CameraTagRestApiKey);
}
<player id="@Model.Id"
data-uuid='@(Model.VideoUuid)'
data-options='{"width":"100%","height":"100%", "aspectratio":"4:3", "displaytitle":"false","displaydescription":"false"}'
data-signature="@signature" data-signature-expiration="@expiration"></player>
你能否显示部分视图'MVC.Shared.Views.Partials.CameraTagVideoPlayer'? –
@JoseLuis刚刚添加!这有帮助吗? – Dukakus17