需要一些帮助,因为我仍然是编程新手。我有一个有五列的gridview,三列由复选框组成。然后,如果它们被选中,我需要获取这些复选框的值并将其放入 IList。我的问题是将它添加到我的 IList 时如何实现它。请帮忙。请参阅下面的代码。我知道有些不对劲。
public IList<Title> Checkboxes
{
get
{
CheckBox chkEPS;
CheckBox chkIMDF;
CheckBox chkPS;
IList<Title> checkedList = new List<Title>();
foreach (GridViewRow row in gvwTitles.Rows)
{
chkABC = (CheckBox)row.FindControl("chkABC");
chkABCD = (CheckBox)row.FindControl("chkABCD");
chkABCDE = (CheckBox)row.FindControl("chkABCDE");
if ((chkABC.Checked) && (chkABCD.Checked) && (chkABCDE.Checked))
{
checkedList.Add(new Title(What will be the value));
// how will I add the value, I am also considering what if the user check the chkABC checkbox, while the others were not checked??
}
}
return checkedList;
}
}
public Title(int id, bool _isPocketSharing, bool _isPreventSplitting, bool _isMissingDataFile)