通過Pro ASP.NET MVC書籍的工作,我得到以下代碼片段出現在aspx(view)頁面中...如何呈現以下asp.net mvc c#代碼片段作爲vb.net代碼
<%= Html.DropDownList ("WillAttend",new[]
{
new SelectListItem { Text = "Yes, I'll be there",Value=bool.TrueString},
new SelectListItem { Text = "No, I can't come",Value=bool.FalseString}
},"Choose an option"); %>
有人可以幫助我將其轉換爲vb.net等效。
任何想法的人?
編輯
更多詳情
這裏是整個代碼段。不知道它會有幫助,但它在這裏。
<body>
<h1>RSVP</h1>
<% using(Html.BeginForm()) { %>
<p> Your name: <%= Html.TextBox("Name") %></p>
<p> Your email: <%= Html.TextBox("Email") %></p>
<p> Your phone: <%= Html.TextBox("Phone") %></p>
<p>
Will you attend?
<%= Html.DropDownList ("WillAttend",new[]
{
new SelectListItem { Text = "Yes, I'll be there",Value=bool.TrueString},
new SelectListItem { Text = "No, I can't come",Value=bool.FalseString}
},"Choose an option") %>
</p>
<input type="submit" value="Submit RSVP" />
<% } %>
</body>
任何幫助表示讚賞。我真的無法弄清楚這一點。
賽斯
謝謝你的回答......讓你在一分鐘知道是否奏效。 對於記錄...在發佈我的問題之前,我嘗試將代碼轉換爲http://www.developerfusion.com/tools/convert/vb-to-csharp/ Seth – 2009-08-04 03:48:53
爲了記錄...那沒用。 [「WillAttend」,New()]在New之後有一個錯誤波形線(反正叫什麼?),表示Type Expected。 New NewList中的[New SelectListItem]在語法錯誤的新單詞下有一個波形。所有的數組加載器({})都有錯誤,表明語法錯誤。與選擇一個選項字符串相同。 – 2009-08-04 03:54:26
嘗試建設。也嘗試發佈周圍的HTML代碼。我發現寫入時調試器有點吸引人的查看頁面,尤其是如果它在一個標籤內(不知道爲什麼會這樣,但是...) – 2009-08-04 06:07:51