如何将复选框值从表示层传递给数据层 [英] How to pass checkbox value from presentation layer to datalayer
本文介绍了如何将复选框值从表示层传递给数据层的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将复选框值从表示层传递给数据层
例如:传递一个文本框值
how to pass checkbox value from presentation layer to datalayer
Eg:passing a text box value is given
objLocalBO.TbRemarks = txtRemarks.Text;
其中 TbRemarks
是表格的字段/>
如何传递复选框值如上所示....
where TbRemarks
is the field of the table
how to pass Check box value as above ....
推荐答案
你可以使用 CheckBox.Checked Property [< a href =http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.checkbox.checked(v=vs.110).aspx\"target =_ blanktitle =New窗口> ^ ]
您可以查看文档,如果选中复选框,则此属性值将为true。否则是假的。
you can use the CheckBox.Checked Property[^]
You can go and check the documentation, in case of checkbox checked this property value will be true. otherwise false.
bool checkeval = checkbox1.Checked;
如果你需要设置 objLocalBO.TbRemarks
作为复选框选中的值,那么 TbRemarks
属性应该 bool
键入直接设置值。如果 TbRemarks
属性是字符串类型,那么您需要将值转换为类似的字符串checkbox1.Checked.ToString()
if you need to set objLocalBO.TbRemarks
as checkbox checked value then TbRemarks
property should have bool
type for directly set the value. if TbRemarks
property is string type then you need to cast the value to a string like checkbox1.Checked.ToString()
参考:获取+值+来自+ ASP + NET +复选框 [ ^ ]
这篇关于如何将复选框值从表示层传递给数据层的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文