Hi Folks,
Is it possible to access the SQLDataSource for a checkboxlist in the code behind? I have several checkbox lists that require nearly identical code in their databound events, in order to display already-selected items in the edititemtemplate. I've gotten this far in "genericizing" the event code:
CheckBoxList chkbx = (CheckBoxList)sender as CheckBoxList;
DataView dv = (DataView)sqlDS_datasource.Select(DataSourceSelectArguments.Empty);
foreach (DataRow dr in dv.Table.Rows)
{
for (int i = 0; i < chkbx.Items.Count; i++)
{
if (chkbx.Items[i].ToString() == dr[chkbx.DataTextField].ToString())
{
chkbx.Items[i].Selected = true;
}
}
}
To obtain the SQLDataSource for the checkboxlist, I've tried:
...
Go to the complete details ...