【问题标题】:Check from JQuery if value exists in ViewBag从 JQuery 检查 ViewBag 中是否存在值
【发布时间】:2012-12-26 10:11:31
【问题描述】:

我试图检查 ViewBag 中的值是否来自JQuery

if("<%: ViewBag.isSearchEnabled %>" != null && "<%: ViewBag.isSearchEnabled %>" != "True")
        {
        $("#CompanySearchPanel").hide();
        }  

这应该根据this 工作,但它给出了以下错误:

The call is ambiguous between the following methods or properties: 'System.IO.TextWriter.Write(string, params object[])' and 'System.IO.TextWriter.Write(char[])'  

仅供参考,ViewBag 中不存在此值。

有人可以帮我吗?

【问题讨论】:

标签: c# jquery asp.net viewbag


【解决方案1】:

我刚刚找到this 链接,其中提到类型转换是解决方案。不知道需要类型转换。我刚做了这个,它正在工作。

请建议这是否是正确的原因。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-06-13
    • 2011-12-14
    • 1970-01-01
    • 1970-01-01
    • 2015-04-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多