asp.net gride view delete row and returne cell

Feb 14 2016 4:57 AM

i have gride view and i add delete action on it it want when the user press on delete return value in exact cell to save it in another table who can i do this ?

i have this code :

  1. using (SqlCommand _Cmd_Insert_NewLog = new SqlCommand("INSERT INTO tblLog (UserName,PCName,PCIP,LogDate,Note) VALUES(@UserName,@PCName,@PCIP,@LogDate,@Note)"))  
  2. {  
  3.  //------- To Get User Name -----------//  
  4.  string _StrUserName = "";  
  5.  _StrUserName = Session["EmployeeUserName"].ToString();  
  6.   
  7.  //------- To Get Computer Name -----------//  
  8.   
  9.  string _StrHostName = "";     _StrHostName = Dns.GetHostName();  
  10.   
  11.  //------- To Get IP Address  -----------//  
  12.   
  13.  string _StrHostIP = "";  
  14.   
  15.  _StrHostIP = HttpContext.Current.Request.UserHostAddress.ToString();  
  16.  string _Str_Note = "The User : " + _StrUserName + " | Delete The Item With Barcode : " + LblBarcode.Text.Trim().ToString() + " | In Date : " + _DateAdd;  
  17. _Cmd_Insert_NewLog.CommandType = CommandType.Text;  
  18. _Cmd_Insert_NewLog.Parameters.AddWithValue("@UserName", _StrUserName);  
  19. _Cmd_Insert_NewLog.Parameters.AddWithValue("@PCName", _StrHostName);  
  20. _Cmd_Insert_NewLog.Parameters.AddWithValue("@PCIP", _StrHostIP);  
  21. _Cmd_Insert_NewLog.Parameters.AddWithValue("@LogDate", DateTime.Parse(_DateAdd));  
  22. _Cmd_Insert_NewLog.Parameters.AddWithValue("@Note", _Str_Note);  
  23. _Cmd_Insert_NewLog.Connection = _Conn;       
  24.   
  25. //_Conn.Open();  
  26. _Cmd_Insert_NewLog.ExecuteNonQuery();  
  27. _Conn.Close();  
  28.   

LblBarcode.Text.Trim() its label i want to read the barcode from it the barcode in the grideview in cell 4


Answers (4)