protected void LnkDeviceOp_Click(object sender, ImageClickEventArgs e) { int index = ((GridViewRow)((ImageButton)sender).Parent.Parent).RowIndex; string ip = gvDevice.DataKeys[index]["IP_Address"].ToString(); string deviceid = gvDevice.DataKeys[index]["Device_Id"].ToString(); string port = gvDevice.DataKeys[index]["Port"].ToString(); Session["DevId"] = deviceid; bool b = false; b = objDeviceOp.Device_Connection(ip, Convert.ToInt32(port), 0); if (b == true) { lblDeviceId.Text = deviceid; lblDeviceWithId.Text = gvDevice.DataKeys[index]["Device_Name"].ToString(); DataTable dtLog = new DataTable(); dtLog = objDeviceOp.GetUserLog(ip, Convert.ToInt32(port)); dtLog = FilterLog(dtLog); if (dtLog.Rows.Count > 0) { gvLog.DataSource = dtLog; gvLog.DataBind(); Session["dtDownloadLog"] = dtLog; } else { DisplayMessage("No Log Data Exists"); return; } } else { DisplayMessage("Unable to connect the device"); return; } pnlList.Visible = false; pnlDeviceOp.Visible = true; Session["IPForOp"] = ip; Session["PortForOp"] = port; Session["DeviceIdForOp"] = gvDevice.DataKeys[index]["Device_Id"].ToString(); }