S
Stephan Bour
I was playing with this simple code strait from MSDN and I got the following
compile error:
³foreach statement cannot operate on variables of type
'System.Web.UI.WebControls.DataList' because
'System.Web.UI.WebControls.DataList' does not contain a definition for
'GetEnumerator', or it is inaccessible"
protected void UpdateNewOligos (Object sender, EventArgs e) {
int rowCount = 0;
StringBuilder gridSelections = new StringBuilder();
foreach (DataListItem NewOrdersDataListItem in NewOrdersDataList) {
CheckBox chkSelectNew =
(CheckBox)NewOrdersDataListItem.Cells[0].Controls[1];
if (chkSelectNew.Checked == true) {
rowCount++;
gridSelections.AppendFormat("The checkbox for [0] was
selected<br>",
NewOrdersDataList.DataKeys[NewOrdersDataListItem.ItemIndex].ToString());
}
}
gridSelections.Append("<br>");
gridSelections.AppendFormat("Total number selected is: (0)",
rowCount.ToString());
}
Any idea?
Thanks,
Stephan.
compile error:
³foreach statement cannot operate on variables of type
'System.Web.UI.WebControls.DataList' because
'System.Web.UI.WebControls.DataList' does not contain a definition for
'GetEnumerator', or it is inaccessible"
protected void UpdateNewOligos (Object sender, EventArgs e) {
int rowCount = 0;
StringBuilder gridSelections = new StringBuilder();
foreach (DataListItem NewOrdersDataListItem in NewOrdersDataList) {
CheckBox chkSelectNew =
(CheckBox)NewOrdersDataListItem.Cells[0].Controls[1];
if (chkSelectNew.Checked == true) {
rowCount++;
gridSelections.AppendFormat("The checkbox for [0] was
selected<br>",
NewOrdersDataList.DataKeys[NewOrdersDataListItem.ItemIndex].ToString());
}
}
gridSelections.Append("<br>");
gridSelections.AppendFormat("Total number selected is: (0)",
rowCount.ToString());
}
Any idea?
Thanks,
Stephan.