我正在通過MVC音樂商店在Visual Basic(mvcmusicstore.codeplex.com),試圖轉換的東西,因爲我去。然而,我對視圖中的一些lambda表達式造成了麻煩。具體來說,第53頁當使用相冊編輯模板上,我沒有看到我的編輯模板時,我使用下面的代碼:在VB中的MVC音樂商店教程?
原文: <%: Html.EditorFor(model => model.Album,
new { Artists = Model.Artists, Genres = Model.Genres}) %>
我VB: <%: Html.EditorFor(Function(model) model.Album,
New With { .Artists = Model.Artists, .Genres = Model.Genres}) %>
但頁面根本不顯示模板。我無法在VB Lambdas上找到太多有用的資源來判斷我是否做對了!
嗨,對不起,我忘了我在這裏留下了這個問題! 事實證明,前幾頁有一個錯誤 - 一旦與其他人進行比較,問題就出現了,並且工作得很好。 儘管感謝您的報價! – 2010-07-26 07:51:32
沒問題。你能幫我重寫下面的代碼嗎?我無法弄清楚它應該在VB中。你知道任何良好的VB MVC 2資源? <%:Html.DropDownList(「ArtistId」,new SelectList(ViewData [「Artists」] as IEnumerable,「ArtistId」,「Name」,Model.ArtistId))%> – Rob 2010-07-26 09:08:46
當然 - 在VB中,你不能('ArtistId',New SelectList(CType(ViewData(「Artists」),IEnumerable),「ArtistId」,「UserId」名稱「,Model.ArtistId))%>' 恐怕我不知道任何好的資源 - 您只需要能夠閱讀C#並計算轉換。蘭姆達斯可能是最難的部分。 – 2010-07-26 13:39:12