我需要添加复选框列到我的gridview在C#中。放置在GridView中的复选框在C#
我有我的代码:
foreach (GridViewRow objRow in GrdDynamicControls.Rows)
{
if (dttableDetails.Columns.Contains(strColumnName))
{
position = dttableDetails.Columns[strColumnName].Ordinal;
if (strtype.Contains("CheckBox"))
{
try
{
GrdDynamicControls.Rows[i].Cells.RemoveAt(position);
chkCheckBox.ID = strControlName;
chkCheckBox.AutoPostBack = true;
tcCheckCell.Controls.Add(chkCheckBox);
objRow.Cells.Add(tcCheckCell);
// GrdDynamicControls.Rows[i].Cells.AddAt(position, tcCheckCell);
}
catch { }
chkCheckBox.CheckedChanged += new EventHandler(chkCheckBox_CheckedChanged);
}
}
}
但这overwritting在GridView中每个的objRow的复选框。即时通讯不能得到GridView.pls帮助中所有行的特定列的复选框...
没有即时创建控件dynamically.it不是奥菱checkbox.ill报复下拉列表太。所以在GridView中的动态绑定我已经使用代码来创建复选框 – Innova 2010-06-23 13:56:18