protected void m_grid_RowCommand(object sender, GridViewCommandEventArgs e) { try { string commandName = e.CommandName; GridViewRow row = m_grid.FooterRow; if (commandName == "Insert") { clsPhieuXuat oPhieuXuat = new clsPhieuXuat(); oPhieuXuat.NhanVienLogon_Id = "3d2df69a-4d7c-4d78-a4a3-075a169a109d"; oPhieuXuat.PhieuXuat_Id = sKey; oPhieuXuat.ThongTinThietBi_Id = sThongTinThietBi_Id; oPhieuXuat.InsertChiTietPhieuXuat(); bindData(-1); sThongTinThietBi_Id = ""; } else if (commandName == "TimKiem") { string Ma_Serial = ((TextBox)row.FindControl("txtIMa_Serial")).Text; string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["SQLConn"].ToString();// "server='NgoQuangLua-PC'; uid=sa;pwd=sa; Database='QL'; trusted_connection=true;"; System.Data.SqlClient.SqlConnection sqlConnection = new System.Data.SqlClient.SqlConnection(connectionString); string queryString = "select * from ThongTinThietBi a where a.Ma_Serial='" + Ma_Serial + "' and a.trang_thai in (1,7)"; sqlConnection.Open(); SqlDataAdapter oAdap = new SqlDataAdapter(queryString, sqlConnection); DataTable tblTemp = new DataTable(); oAdap.Fill(tblTemp); if (tblTemp.Rows.Count > 0) { ((TextBox)row.FindControl("txtIMA_MAC")).Text = tblTemp.Rows[0]["Ma_MAC"].ToString(); ((TextBox)row.FindControl("txtIMA_DLK")).Text = tblTemp.Rows[0]["Ma_DLK"].ToString(); ((TextBox)row.FindControl("txtIMA_SLC")).Text = tblTemp.Rows[0]["Ma_SLC"].ToString(); sThongTinThietBi_Id = tblTemp.Rows[0]["ThongTinThietBi_Id"].ToString(); } } } catch (Exception ex) { ltlAnnouncement.Text = "Khong them moi duoc du lieu. Vui long lien he voi quan tri<br>" + ex.Message; } }