C# 剑道Tabstrip中的Razor语法
我对此代码有异议,它显示;编译过程中缺少错误。 实际上,我正在尝试将aspx代码切换到razor语法mvc5项目。代码在aspx中工作,所以我不确定我在razor中做错了什么。任何帮助都将不胜感激C# 剑道Tabstrip中的Razor语法,c#,asp.net,asp.net-mvc,razor,kendo-asp.net-mvc,C#,Asp.net,Asp.net Mvc,Razor,Kendo Asp.net Mvc,我对此代码有异议,它显示;编译过程中缺少错误。 实际上,我正在尝试将aspx代码切换到razor语法mvc5项目。代码在aspx中工作,所以我不确定我在razor中做错了什么。任何帮助都将不胜感激 tabstrip.Add() .Text(item.Title) //.HtmlAtt
tabstrip.Add()
.Text(item.Title)
//.HtmlAttributes(new { tabindex = "-1" })
.Selected(true)
.Content(() =>
{
using (Html.BeginForm(null, null, FormMethod.Post, new { id = "tabForm" }))
{
@<div style="width:980px;min-height:562px;margin-left:0px;margin-right:0px">
<div>
@Html.ValidationSummary(false);
@RenderBody();
</div>
<div style="padding-top:30px; text-align:center;">
@{
string roStyle = ViewData[Constants.ReadOnly].ToString();
string roMessage = "";
string roButtonText = "Cancel";
//if (helper_readonly.Value == "true")
if (Model.helper_readonly == "true")
{
roStyle = "style='display:none;'";
roMessage = "READ ONLY - changes are not saved";
roButtonText = "Close";
}
}
<table border="0" width="100%">
<tr>
<td style="width:30%;" align="left">
<input type="button" id="ToggleDiagnosticsButton" value="Show Diagnostics" class="k-button cancel" style="display:none;" />
</td>
<td style="width:40%;" align="center">
<input type="submit" id="SaveButton" value="Save" class="k-button" @disabled @roStyle />
<input type="submit" id="CancelButton" value="@roButtonText" class="k-button cancel" onblur="LastOnBlur()" />
<input type="submit" id="submithelper" value="Cancel" class="cancel" style="display:none;" />
</td>
<td style="width:30%;" align="right">
<span style="color:Red;">@roMessage</span>
</td>
</tr>
</table>
</div>
@Html.Hidden("NextActionHelper", Model.NextActionHelper);
@Html.Hidden("UserFormAction", Model.UserFormAction);
</div>
}
});
tabstrip.Add()
.文本(项目.标题)
//.HtmlAttributes(新的{tabindex=“-1”})
.已选择(真)
.Content(()=>
{
使用(Html.BeginForm(null,null,FormMethod.Post,new{id=“tabForm”}))
{
@
@Html.ValidationSummary(false);
@RenderBody();
@{
字符串roStyle=ViewData[Constants.ReadOnly].ToString();
字符串roMessage=“”;
字符串robuttonext=“取消”;
//if(helper_readonly.Value==“true”)
if(Model.helper\u readonly==“true”)
{
roStyle=“style='display:none;”;
roMessage=“只读-不保存更改”;
robuttonext=“关闭”;
}
}
@罗密斯
@隐藏(“NextActionHelper”,Model.NextActionHelper);
@隐藏(“UserFormAction”,Model.UserFormAction);
}
});
编译错误;最后一行的第二行是missing
完整代码:
@(Html.Kendo()
.TabStrip()
.Animation(false)
.Name("tabstripForms")
.Events(events => { events.Select("onFormTabSelect"); })
.Items(tabstrip =>
{
foreach (var item in ViewData[Constants.ViewDataKey_ActionTabMenu] as
List<BusinessEntities.DTO.Shared.MvcMenuItem>)
{
bool selected = item.Action.ToLower() == ViewData[Constants.ViewDataKey_CurrentAction].ToString().ToLower() ? true : false;
if (selected)
{
//helper_post_on_cancel.Value = item.PostBackOnCancel.ToString();
Model.helper_post_on_cancel = item.PostBackOnCancel.ToString();
//helper_post_on_tabselect.Value = item.PostBackOnTabSelect.ToString();
Model.helper_post_on_tabselect = item.PostBackOnTabSelect.ToString();
tabstrip.Add()
.Text(item.Title)
//.HtmlAttributes(new { tabindex = "-1" })
.Selected(true)
.Content(() =>
{
using (Html.BeginForm(null, null, FormMethod.Post, new { id = "tabForm" }))
{
@<div style="width:980px;min-height:562px;margin-left:0px;margin-right:0px">
<div>
@Html.ValidationSummary(false);
@RenderBody();
</div>
<div style="padding-top:30px; text-align:center;">
@{
string roStyle = ViewData[Constants.ReadOnly].ToString();
string roMessage = "";
string roButtonText = "Cancel";
//if (helper_readonly.Value == "true")
if (Model.helper_readonly == "true")
{
roStyle = "style='display:none;'";
roMessage = "READ ONLY - changes are not saved";
roButtonText = "Close";
}
}
<table border="0" width="100%">
<tr>
<td style="width:30%;" align="left">
<input type="button" id="ToggleDiagnosticsButton" value="Show Diagnostics" class="k-button cancel" style="display:none;" />
</td>
<td style="width:40%;" align="center">
<input type="submit" id="SaveButton" value="Save" class="k-button" @disabled @roStyle />
<input type="submit" id="CancelButton" value="@roButtonText" class="k-button cancel" onblur="LastOnBlur()" />
<input type="submit" id="submithelper" value="Cancel" class="cancel" style="display:none;" />
</td>
<td style="width:30%;" align="right">
<span style="color:Red;">@roMessage</span>
</td>
</tr>
</table>
</div>
@Html.Hidden("NextActionHelper", Model.NextActionHelper);
@Html.Hidden("UserFormAction", Model.UserFormAction);
</div>
}
});
}
else
{
tabstrip.Add()
.Text(item.Title)
//.HtmlAttributes(new { tabindex = "-1" })
.Selected(false)
.Content(() =>
{
@<div style="min-height: 562px;">
<div class="k-loading-mask" style="width:982px;height:562px;">
<div class="k-loading-image">
</div>
</div>
</div>
});
}
}
})
)
@(Html.Kendo()
.TabStrip()
.动画(错误)
.Name(“tabstripForms”)
.Events(Events=>{Events.Select(“onFormTabSelect”);})
.Items(tabstrip=>
{
foreach(ViewData[Constants.ViewDataKey\u ActionTabMenu]中的变量项)作为
(列表)
{
bool selected=item.Action.ToLower()==ViewData[Constants.ViewDataKey\u CurrentAction].ToString().ToLower()?真:假;
如果(选定)
{
//helper\u post\u on\u cancel.Value=item.PostBackOnCancel.ToString();
Model.helper\u post\u on\u cancel=item.PostBackOnCancel.ToString();
//helper_post_on_tabselect.Value=item.PostBackOnTabSelect.ToString();
Model.helper\u post\u on_tabselect=item.PostBackOnTabSelect.ToString();
tabstrip.Add()
.文本(项目.标题)
//.HtmlAttributes(新的{tabindex=“-1”})
.已选择(真)
.Content(()=>
{
使用(Html.BeginForm(null,null,FormMethod.Post,new{id=“tabForm”}))
{
@
@Html.ValidationSumma
@(Html.Kendo()
.TabStrip()
.Animation(false)
.Name("tabstripForms")
.Events(events => { events.Select("onFormTabSelect"); })
.Items(tabstrip =>
{
foreach (var item in ViewData[Constants.ViewDataKey_ActionTabMenu] as List<BusinessEntities.DTO.Shared.MvcMenuItem>)
{
bool selected = item.Action.ToLower() == ViewData[Constants.ViewDataKey_CurrentAction].ToString().ToLower() ? true : false;
if (selected)
{
//helper_post_on_cancel.Value = item.PostBackOnCancel.ToString();
Model.helper_post_on_cancel = item.PostBackOnCancel.ToString();
//helper_post_on_tabselect.Value = item.PostBackOnTabSelect.ToString();
Model.helper_post_on_tabselect = item.PostBackOnTabSelect.ToString();
tabstrip.Add()
.Text(item.Title)
//.HtmlAttributes(new { tabindex = "-1" })
.Selected(true)
.Content(() =>
{
using (Html.BeginForm(null, null, FormMethod.Post, new { id = "tabForm" }))
{
@<div style="width:980px;min-height:562px;margin-left:0px;margin-right:0px">
<div>
@Html.ValidationSummary(false);
@RenderBody();
</div>
<div style="padding-top:30px; text-align:center;">
@{
string roStyle = ViewData[Constants.ReadOnly].ToString();
string roMessage = "";
string roButtonText = "Cancel";
//if (helper_readonly.Value == "true")
if (Model.helper_readonly == "true")
{
roStyle = "style='display:none;'";
roMessage = "READ ONLY - changes are not saved";
roButtonText = "Close";
}
}
<table border="0" width="100%">
<tr>
<td style="width:30%;" align="left">
<input type="button" id="ToggleDiagnosticsButton" value="Show Diagnostics" class="k-button cancel" style="display:none;" />
</td>
<td style="width:40%;" align="center">
<input type="submit" id="SaveButton" value="Save" class="k-button" @disabled @roStyle />
<input type="submit" id="CancelButton" value="@roButtonText" class="k-button cancel" onblur="LastOnBlur()" />
<input type="submit" id="submithelper" value="Cancel" class="cancel" style="display:none;" />
</td>
<td style="width:30%;" align="right">
<span style="color:Red;">@roMessage</span>
</td>
</tr>
</table>
</div>
@Html.Hidden("NextActionHelper", Model.NextActionHelper);
@Html.Hidden("UserFormAction", Model.UserFormAction);
</div>
}
});
}
else
{
tabstrip.Add()
.Text(item.Title)
//.HtmlAttributes(new { tabindex = "-1" })
.Selected(false)
.Content(() =>
{
@<div style="min-height: 562px;">
<div class="k-loading-mask" style="width:982px;height:562px;">
<div class="k-loading-image">
</div>
</div>
</div>
});
}
}
}
)