If i understand you well, you want to pass several parameters into sql command as a single parameter (a list of id's).
List<string> selectedIds = new List<string>();
selectedIds.Add("'" + item.Cells[1].Value.ToString() + "'");
String sql = "delete from tabl where id in(@idsToDelete)";
cmd.Parameters.Add("@idsToDelete", SqlDbType.varchar).Value = string.Join(",", selectedIds);
As OriginalGriff mentioned, you're trying to pass string value ('1,2,3,4') into sql command instead of their original values(array of [1,2,3,4]). So, your command is getting single varchar parameter instead of an array of numeric values! This is a main cause of your error. So, you can resolve your issue by:
1) passing every single value into command and execute a command in a loop, but it may be the reason of slow performance. It might looks like
dDOS attack[
^]!
or
2) passing an array of values into command.
A recommended way is to use
Table-Valued Parameters | Microsoft Docs[
^]. Follow the link. There you'll find information how to achieve that!