2013-09-26 43 views

回答

3

您需要使用新的關鍵字,您可以添加HTML屬性,像這樣:

@Html.LabelFor(model => model.First, new { @class = "test", id = "Lbl1"})) 

Etc..You可以不斷加入HTML新屬性裏面{}。

+0

您需要用'@'前綴'class'來轉義它。這是一個C#關鍵字:'new {@class =「test」...' –

+0

謝謝你的絕對正確。進行編輯。 – Botonomous

+0

我遇到了這種方法的錯誤。紅色 – Nation

2

@Html.LabelFor(model => model.First, new Dictionary<string, object>() { { "class", "class-name" }, { "style", "display:none" } });

那是什麼ü意味着什麼呢?

+0

我得到這種方法的錯誤。代碼用紅色加下劃線 – Nation