0

So I have no idea why I'm getting this issue with the Guid here. Can anyone please lend some insight?

@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) 

1 Answer 1

2

You should put initialization in a code block. Then you can drop all the @s:

@{
    Guid messageID = System.Guid.NewGuid();
    string x = messageID.ToString();
}

The Introduction to ASP.NET Web Programming Using the Razor Syntax (C#) is a must read.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.