C# .NET Razor+;引导如何将很长的元素声明拆分为多行代码
当使用Razor语法声明某个引导元素时,如何将其拆分为多行 我有一行很长的代码,在一行代码中看起来很愚蠢。 下面是我要拆分的代码行:C# .NET Razor+;引导如何将很长的元素声明拆分为多行代码,c#,asp.net-mvc,twitter-bootstrap,asp.net-mvc-4,razor,C#,Asp.net Mvc,Twitter Bootstrap,Asp.net Mvc 4,Razor,当使用Razor语法声明某个引导元素时,如何将其拆分为多行 我有一行很长的代码,在一行代码中看起来很愚蠢。 下面是我要拆分的代码行: @f.FormGroup().TextBoxFor(m => m.EquipmentItem.Fields[field.Key].FieldValue).Id(field.Key.ID.ToString()).HtmlAttributes(new { @Name = name, @class = "dynamicField" }).WidthLg(formW
@f.FormGroup().TextBoxFor(m => m.EquipmentItem.Fields[field.Key].FieldValue).Id(field.Key.ID.ToString()).HtmlAttributes(new { @Name = name, @class = "dynamicField" }).WidthLg(formWidth).Append(Html.Bootstrap().Button().Id("ipAddrWebPageButton").Text(buttonText)).Label().LabelText(field.Key.Name).ShowRequiredStar(field.Key.Required)
我尝试过不同的方法,比如在一个点之前或之后拆分一行,也尝试过在新行的开头添加一些@符号,尝试四处寻找答案,但完全没有发现任何结果
我知道并且已经在正则C#中完成了这种在多行上链接拆分的方法,所以我假设它可以在Razor中完成。我的假设错了吗?
如果没有,怎么做?用()
@我爱你!我会在时间限制结束后或午餐后接受答案。这很简单,但出于某种原因,我无法在谷歌搜索中找到答案。
@(f.FormGroup().TextBoxFor(m => m.EquipmentItem.Fields[field.Key].FieldValue)
.Id(field.Key.ID.ToString()).HtmlAttributes(new { @Name = name, @class = "dynamicField" })
.WidthLg(formWidth).Append(Html.Bootstrap().Button().Id("ipAddrWebPageButton")
.Text(buttonText)).Label().LabelText(field.Key.Name).ShowRequiredStar(field.Key.Required))