protected void btnSendReturn_OnClick(object sender, EventArgs e) { int id = Convert.ToInt32((sender as LinkButton).CommandArgument); int rowIndex = -1; foreach (GridViewRow row in tblList.Rows) { int currId = Convert.ToInt32(((HiddenField)row.FindControl("hfIdClaimUnit")).Value); if (currId == id) { rowIndex = row.RowIndex; break; } } //((WebControl)sender).NamingContainer.ID if (rowIndex >= 0) { HiddenField hfIdClaim = (HiddenField)tblList.Rows[rowIndex].FindControl("hfIdClaim"); int idClaim = MainHelper.HfGetValueInt32(ref hfIdClaim); var txtReturnDescr = tblList.Rows[rowIndex].FindControl("txtReturnDescr") as TextBox; string descr = MainHelper.TxtGetText(ref txtReturnDescr); ClaimUnit cu = new ClaimUnit() { Id = id, IdClaim = idClaim, IdCreator = User.Id }; try { cu.SupplyReturn(descr); } catch (Exception ex) { ServerMessageDisplay(new[] { phServerMessage }, ex.Message, true); } Claim c = new Claim() { Id = idClaim, IdCreator = User.Id }; try { c.SupplyReturnClaim(); } catch (Exception ex) { ServerMessageDisplay(new[] { phServerMessage }, ex.Message, true); } tblList.DataBind(); } SetRowEditState(id, false); }