从MVC Razor C#转换为MVC Razor VB

时间:2016-10-02 05:12:18

标签: c# asp.net-mvc vb.net razor

我正在将一个MVC C#项目转换为MVC VB。我此时遇到错误

<input name = "recipients" type="text" Class="form-control" 
      value="@ViewBag.Email" @(ViewBag.Email == null ? "disabled"  null) />

如何将其转换为MVC VB 错误消息 ==表达预期 null未声明 ?字符不能使用。

这是代码

<div Class="col-sm-12">
    <div Class="form-group">
        <button Class="btn btn-default" id="get-my-email- address">@Resources.Resource.Graph_GetEmailAddress_Button</button>
    </div>
</div>
    }
<div Class="col-sm-12">
<label for="user-email-address">@Resources.Resource.Graph_GetEmailAddress_Results_Label</label>
<pre name = "user-email-address" >@ViewBag.Email</pre>
</div>

<h2>@Resources.Resource.Graph_SendMail_Heading</h2>
<p>@Html.Raw(Resources.Resource.Graph_SendMail_Instruction)</p>
@(Html.BeginForm("SendEmail", "Home"))
{
<div Class="col-sm-12">
        <div Class="form-group">
            <label  for="recipients">@Resources.Resource.Graph_SendMail_Recipients_Label</label>
            <input name = "recipients" type="text" Class="form-control" value="@ViewBag.Email" @(ViewBag.Email == null ? "disabled"  null) />
        </div>
        <div Class="form-group">
            <label for="subject">@Resources.Resource.Graph_SendMail_Subject_Label</label>
            <input name = "subject" type="text" Class="form-control" value="@Resources.Resource.Graph_SendMail_Subject_Text @Resources.Resource.App_Name_Short" @(ViewBag.Email == null ? "disabled"  null) />
        </div>
        <div Class="form-group">
            <button Class="btn btn-default @(ViewBag.Email == null ? "disabled" : null)">@Resources.Resource.Graph_SendMail_Button</button>
            <input name = "email-address" value=@ViewBag.Email type="hidden" />
        </div>
    </div>
    }
   <div Class="col-sm-12">
  <p Class="@(ViewBag.Message == null ? "hidden" : null)">@Html.Raw  (ViewBag.Message)</p>
 </div>

1 个答案:

答案 0 :(得分:0)

我认为你错过了&#34; :&#34;对于&#34;其他&#34;在@(ViewBag.Email == null?&#34;禁用&#34; HERE null)??应该是:

@(ViewBag.Email == null ? "disabled" : null)