protected void gv2_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("Transfer")) { try { int id = int.Parse(e.CommandArgument.ToString()); TransferTableAdapters.TransferTableAdapter transferTA = new TransferTableAdapters.TransferTableAdapter(); transferTA.TransferPeople(id, int.Parse(ddlCompany1.Text), int.Parse(ddlDepartment1.Text), loggedInUserId); } catch { } } }
protected void btnTransferAll2_Click(object sender, EventArgs e) { foreach (GridViewRow gr in gv2.Rows) { try { HiddenField hfId = (HiddenField)gr.FindControl("hfId2"); TransferTableAdapters.TransferTableAdapter ta = new TransferTableAdapters.TransferTableAdapter(); ta.TransferPeople(int.Parse(hfId.Value), int.Parse(ddlCompany1.SelectedValue), int.Parse(ddlDepartment1.SelectedValue), loggedInUserId); } catch { } } }