它是真还是假,请你分享我的解决方案 [英] Is it returns true or false, could you please share me solution

查看:88
本文介绍了它是真还是假,请你分享我的解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

型号:





model:


public bool Checkbox { get; set; }







控制器:



ViewBag.Checkbox = ExistingKeys.Checkbox;






controller:

ViewBag.Checkbox = ExistingKeys.Checkbox;

SqlParameter strCheckbox = new SqlParameter();
                    strCheckbox = cmdLiveBlogs.Parameters.Add("@Checkbox", SqlDbType.VarChar, 300);
                    strCheckbox.Direction = ParameterDirection.Output;







Keys.Checkbox = Convert.ToBoolean(strCheckbox);







查看:






view:

@Html.CheckBoxFor(model => model.Checkbox, new {@Value = @ViewBag.Checkbox })
           @Html.Label("Enable on Website")





我尝试了什么:



是返回true还是false,请你分享我的解决方案



What I have tried:

is it returns true or false, could you please share me solution

推荐答案

试试这个

try this
cmdLiveBlogs.ExecuteNonQuery();
Keys.Checkbox =Convert.ToBoolean(strCheckbox.Value);


试试这个

try this
cmdLiveBlogs.ExecuteNonQuery();
Keys.Checkbox =Convert.ToBoolean(strCheckbox.Value);



确保 @Checkbox 参数的类型为


我想说两者,这取决于你在UI中做了什么。



你有一个简单的方法可以知道,只需运行代码,你就会自己看。
I would say both, it depend on what you have done in the UI.

You have an easy way to know, just run the code and you will see by yourself.


这篇关于它是真还是假,请你分享我的解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆