问题
I am getting Error 'Cannot apply indexing with [] to an expression of type 'ISet''
for this code snippet
foreach (GridViewRow grv in customTableDataList.UniGrid.GridView.Rows)
{
if (grv != null)
{
if (null != grv.FindControl(ItemCheckBoxID) && ((CheckBox)grv.FindControl(ItemCheckBoxID)).Checked)
{
//At this line I am getting error.
itemIds += customTableDataList.UniGrid.ActionsID[rowCounter] + ", ";
}
rowCounter++;
}
}
Can anyone give some more details to resolve this.
回答1:
Add new using:
System.Linq;
and change
foreach (GridViewRow grv in customTableDataList.UniGrid.GridView.Rows)
{
if (grv != null)
{
if (null != grv.FindControl(ItemCheckBoxID) && ((CheckBox)grv.FindControl(ItemCheckBoxID)).Checked)
{
itemIds += customTableDataList.UniGrid.ActionsID.ToArray()[rowCounter] + ", ";
}
rowCounter++;
}
}
来源:https://stackoverflow.com/questions/38094873/cannot-apply-indexing-with-to-an-expression-of-type-isetstring