【问题标题】:End of statement expected bind dropdown语句结束预期绑定下拉列表
【发布时间】:2014-03-01 05:31:39
【问题描述】:

我有一个带有条件的组合框。我想绑定条件,但是当我运行它时,我收到错误End of statement expected

但是,当我注释掉这些行时,它可以完美运行。

<li>
    <select name="account_type">     
        <option value="I" <% If Request.Form("account_type") = "I" Then Response.Write("SELECTED") End If %> ">Individual</option>
        <option value="C" <% If Request.Form("account_type") = "C" Then Response.Write("SELECTED")  End IF %>>Corporate</option> 
   </select>
</li>

我做错了什么? 我正在使用 VB.Net 内联编码。

【问题讨论】:

    标签: asp.net vb.net visual-studio-2010 inline-code


    【解决方案1】:

    'End If' 仅用于多行 If 块。如果操作与条件在同一行,则不要使用“End If”。此外,您应该计算双引号,因为它们似乎不匹配。

    【讨论】:

    • 你能重写我的代码吗我能理解&lt;option value="I" &lt;% If Request.Form("account_type") = "I" Then Response.Write("SELECTED") End If %&gt; &gt;Individual&lt;/option&gt; &lt;option value="C" &lt;% If Request.Form("account_type") = "C" Then Response.Write("SELECTED") End If %&gt;&gt;Corporate&lt;/option&gt; 目前我正在使用这个
    • @Abhishek 只需从这两行代码中删除 End If
    • @Its Work when I change
    猜你喜欢
    • 1970-01-01
    • 2022-01-22
    • 1970-01-01
    • 2020-02-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多