所以我不知道为什么我会在这里与Guid讨论这个问题。任何人都可以提供一些见解吗?
@using System;
@using AC.Common.Comparing
@using AC.Business.Object.B2BOrderHandling
@using AC.Website.Areas.OrderManagement.Views.B2BOrderHandling.App_LocalResources
@using AC.Website.Areas.OrderManagement.Models
@model ComparisonRowModel
@Guid messageID = System.Guid.NewGuid();
@string x = messageID.ToString();
<div @(Model.Current != null ? string.Format("orderdetailsid={0}", Model.Current.OrderDetailsID) : "") data-guid="@(x)" class="current menuitem @(Model.ChangeType == B2BMenuItemChangeTypeModel.Deleted ? "deleted" : "")">
@switch (Model.ChangeType)
答案 0 :(得分:2)
您应该在代码块中放置初始化。然后你可以删除所有@
s:
@{
Guid messageID = System.Guid.NewGuid();
string x = messageID.ToString();
}
必须阅读Introduction to ASP.NET Web Programming Using the Razor Syntax (C#)。