我试图允许在一个视图中填充的变量的可见性也可以在另一个视图中使用。我该如何做到这一点?第一个视图中使用的两个变量的代码以及我在第二个视图中尝试获得的代码如下:
日历视图
@using (Html.BeginForm("Update", "Calendar"))
{
<h2>Enter The Number Of Days To Display</h2>
@Html.TextBoxFor(model => model.Date, new {id = "Date" })
@Html.LabelFor(model => model.DaysToBeViewed)
@Html.EditorFor(model => model.DaysToBeViewed)
}
更新视图
// Convert both dates to milliseconds
var Date_milSec = model.Date.getTime();
var AddedDays_milSec = model.DaysToBeViewed.getTime();
我想把变量&#39; Date&#39;在Calendar视图中为init,并使用它在“更新视图”页面上填充TextBox。我有一个Calendar.cshtml和一个Update.cshtml。
我这样做了吗?