我想将数据绑定到复选框,但我想显示复选框但不显示绑定数据 [英] I want to bind data to checkbox but i want to display check box but not the binded data

查看:87
本文介绍了我想将数据绑定到复选框,但我想显示复选框但不显示绑定数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实际上我想将数据绑定到复选框,但我想隐藏复选框的数据。我想只显示复选框而不是复选框的标签是否可能...

Actually i want to bind the data to check box but i want to hide the data of the checkbox. i want to display only checkbox not the label of the checkbox is it possible...

推荐答案

您可以使用隐藏字段进行绑定..



写下你的复选框代码..这样..



You can use a hidden field to bind..

write it below ur checkbox code.. this way..

<asp:checkbox id="chkbox1" runat="server" xmlns:asp="#unknown" />
<asp:hiddenfield id="HiddenB1" runat="server" xmlns:asp="#unknown" />







在RowDataBound中写这个。 cs






Write this in RowDataBound .cs

SAMPLEClass entity = (SAMPLEClass)e.Row.DataItem;
HiddenField Hidden1 = (HiddenField)e.Row.FindControl("Hidden1");
Hidden1.Value = entity.somecolumnvaluetobind.ToString();


这篇关于我想将数据绑定到复选框,但我想显示复选框但不显示绑定数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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