c#中的某些复选框可见 [英] visible true of some checkboxes in c#
本文介绍了c#中的某些复选框可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个gridview ...我在gridview中绑定复选框使其显示为false ...现在在gridview_rowdatabound中我想使一些复选框显示为真...但所有复选框都变成了truw ...怎么做?请帮帮我...
i have a gridview...i bind checkbox in gridview make its visible false...now in gridview_rowdatabound i want to make visible true some checkboxes...but all the checkboxes are becoming truw...how to do it?please help me out...
推荐答案
试试这样
Try like this
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
CheckBox chk = e.Row.FindControl("CheckBoxID") as CheckBox;
string someValue = DataBinder.Eval(e.Row.DataItem, "SomeCOlumn").ToString();
chk.Checked = false;
if (someValue == "someCheck")
{
chk.Checked = true;
}
}
}
这篇关于c#中的某些复选框可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文