我的ASP.NET MVC應用程序轉換爲ASP.NET MVC 2 4.0型MvcHtmlString的操作數,並得到這個錯誤:操作 '+' 不能應用於
Operator '+' cannot be applied to operands of type 'System.Web.Mvc.MvcHtmlString' and 'System.Web.Mvc.MvcHtmlString'
HTML = Html.InputExtensions.TextBox(helper, name, value, htmlAttributes)
+ Html.ValidationExtensions.ValidationMessage(helper, name, "*");
豈今要補救嗎?
我是新來的MVC,這裏是代碼: 公共靜態字符串ExTextBox(此的HtmlHelper助手,字符串名稱,對象的值,布爾只讀的,對象htmlAttributes) { 字符串HTML =「」; // if(readOnly)HTML = String.Format(「」,name,value); if(readOnly)HTML = value == null? 「」:value.ToString(); else HTML = System.Web.Mvc.Html.InputExtensions.TextBox(helper,name,value,htmlAttributes)+ System.Web.Mvc.Html.ValidationExtensions.ValidationMessage(helper,name,「*」); 返回HTML; } – hncl 2010-08-31 05:26:54
非常感謝,它的工作 – hncl 2010-08-31 05:33:55
@hnabih:如果這是正確的答案,請不要忘記標記爲:) – 2010-08-31 07:18:01