I see a few problems in your code:
string[] data1 = data.Split(',');
for (int i = 0; i < data1.Length; i++)
{
ClientScript.RegisterStartupScript(GetType(), "alert", "alert('" + data1[i] + "');", true);
}
See
corrections.
Why are you doing things in such a complicated way ?
1) you got a datagrid holding
EmployeeNo
2) you concatenate the
EmployeeNo
in a string
3) you split the string in a list if
EmployeeNo
4) you launch a database script with each
EmployeeNo
You can merge 2 and 3 by building the list directly and skipping the string step.
you can simplify further by not using the list either and launch the script as you know the
EmployeeNo
:
if (chkRow.Checked)
{
string EmployeeNo = row.Cells[2].Text;
ClientScript.RegisterStartupScript(GetType(), "alert", "alert('" + EmployeeNo + "');", true);
}