c# - 从 C# 将布尔值传递给 View
问题描述
如何传递boolean
值进行检查。
下面是我的代码
模型:
[JsonProperty("boolean")]
public bool? boolean{ get; set; }
看法:
bool test = (ViewBag.boolean== null) ? false : (bool)ViewBag.boolean;
if (test == true)
{
<button type="submit" id="xxxx" class=""></button>
}
boolean
是从Json Api存储真假,但无法调用boolean
值进行检查,任何人都可以提供建议吗?谢谢!
解决方案
推荐阅读
- css-modules - 如何在嵌套选择器中跨 css 模块重用 css 属性?
- c# - C# 滚动条延迟
- c# - 在 Azure 上的应用程序预热期间响应 Web 请求
- asp.net-core-webapi - GetWindowThreadProcessId 不使用 .net5.0 API 返回进程 ID
- autodesk-forge - Autodesk forge 配置器发明者添加新模型授权错误
- discord - 如何让我的不和谐机器人状态每 10 秒更改一次?
- reactjs - 样式对象不是开玩笑的
- nanoframework - nanoFramework - I2C 设备没有响应
- kdb - KDB+ / Q 如何在函数中创建命名空间
- networking - DHCP 服务器会始终给我相同的 IP 吗?