How can i show gridview cell value one by one after ping the single ip address and then ping the other ip and show its status in gridview cell and then go to third and so on.
here is my code.
count = dgvStatus.Rows.Count;
for (int i = 0; i < count; i++)
{
string Name = dgvStatus.Rows[i].Cells[0].Text;
string IP = dgvStatus.Rows[i].Cells[1].Text;
try
{
Ping ping = new Ping();
PingReply reply = ping.Send(IP, 5000);
if (reply.Status == IPStatus.Success)
{
result = "UP";
Label status = (Label)dgvStatus.Rows[i].FindControl("lblstatus");
status.Text = result;
Panel panel = (Panel)dgvStatus.Rows[i].FindControl("Panel1");
panel.BackColor = Color.Green;
}
else
{
result = "DOWN";
Label status = (Label)dgvStatus.Rows[i].FindControl("lblstatus");
status.Text = result;
Panel panel = (Panel)dgvStatus.Rows[i].FindControl("Panel1");
panel.BackColor = Color.Red;
}
}
catch (PingException)
{
result = "UNREACHABLE";
Label status = (Label)dgvStatus.Rows[i].FindControl("lblstatus");
status.Text = result;
Panel panel = (Panel)dgvStatus.Rows[i].FindControl("Panel1");
panel.BackColor = Color.Red;
}`