my gridview and added a modal popup like this to view users details
when i click on the approved button inside the modalpopup the status column in the grid must be changed to "Activated " .
present value in that column is "success"
here i am trying to get the selected row value from inside popupmodal i am unable to catch the row index pls help me i dont know what to do
protected void lbtnApprove_Click(object sender, EventArgs e) { try { // BankList list = new BankList(); GridViewRow selectedRow = grdvwMerchantBanks.SelectedRow; long id = list.BeneficiaryID; if (selectedRow != null && long.TryParse(selectedRow.Cells[0].Text, out id)) { using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString)) { con.Open(); SqlCommand cmd = new SqlCommand("UPDATE BeneficiaryDetails SET Status = 'Activated' WHERE BeneficiaryID = @BeneficiaryID", con); cmd.Parameters.AddWithValue("@Beneficiary", id); cmd.ExecuteNonQuery(); con.Close(); } selectedRow.Cells[1].Text = "Activated"; // lblSuccessMessage.Text = "Beneficiary Approved Successfully"; } else { //lblErrorMessage.Text = "Please select a beneficiary"; } } catch(Exception ex) { throw ex; } }
my db i"ve taken identity for beneficiaryid
ALTER procedure [dbo].[usp_InsertMerchantBanks] ( @BeneficiaryID bigint, @BeneficiaryCode nvarchar(200)='' , @BankName nvarchar(250) , @IFSC nvarchar(80) , @AccountNumber nvarchar(200) , @BeneficiaryName nvarchar(200) , @TransactionStatus nvarchar(200)='', @Userid int='' , @APIPartnerID int='' , @NameAsPerBank nvarchar(200)='' , @Validated bit ='', @AccVerifyTransactionID nvarchar(200)='' , @Status nvarchar(200) ='', @CreatedDatetime datetime ='', @username nvarchar(200)='' ) AS BEGIN begin try if(@BeneficiaryID=0) INSERT INTO MerchantBanks VALUES ( @BeneficiaryCode , @BankName , @IFSC , @AccountNumber , @BeneficiaryName , @TransactionStatus , @Userid , @APIPartnerID , @NameAsPerBank , @Validated , @AccVerifyTransactionID , @Status , @CreatedDatetime , @username ) end