【发布时间】:2013-08-28 07:49:18
【问题描述】:
我有一个位类型的数据表列“员工”。在我的网格视图中,我添加了复选框的项目模板。如果“staff”列的值在数据绑定上 =1,我想显示选中的复选框。其他明智的未检查..从我这样写的搜索中
<ItemTemplate>
<asp:CheckBox ID="chk1" runat="server" Checked='<%# bool.Parse(Eval("staff").ToString()) %>'/>
</ItemTemplate>
DataSet ds = new DataSet();
SqlDataAdapter adapter = new SqlDataAdapter("SELECT id,staff FROM staff_details ", con1);
adapter.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
但它显示错误“System.FormatException:字符串未被识别为有效的布尔值。”请帮忙
【问题讨论】:
-
检查我的答案,工作和测试