1
Answer

Gridview Rowupdating

kalandi Acharya

kalandi Acharya

11y
1.5k
1
Hi
I am having a Gridview(ASP.NET with C#) where  i am updating the salary of 5 employees and i want after modification the sum of salary should show in a textbox of my webpage. I have written a function and it is retriving the value but not showing in the textbox.

Please assist me.

My code is like this
 protected void GdvTourDetails_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        bal = new TravelBal();
        dal = new TravelDal();
        if (DdlTbNo.Text != "")
        {
            dal.TABLE_NAME_TMS_TRAVEL_ARRANGEMENT_TB_NO = DdlTbNo.Text.Trim();
        }
        else
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", "alert('Please select the TB No.');", true);
            return;
        }
        TextBox TxtTaxipass = (TextBox)GdvTourDetails.Rows[e.RowIndex].FindControl("TxtTaxipass");
        TextBox TextOthPass = (TextBox)GdvTourDetails.Rows[e.RowIndex].FindControl("TextOthPass");
        TextBox TxtRemark = (TextBox)GdvTourDetails.Rows[e.RowIndex].FindControl("TxtRemark");
        if (TxtTaxipass.Text != "")
        {
            dal.TABLE_NAME_TMS_TB_MASTER_COLUMN_TAXI_CLM_PASS = int.Parse(TxtTaxipass.Text.Trim());
        }
        else
        {
            dal.TABLE_NAME_TMS_TB_MASTER_COLUMN_TAXI_CLM_PASS = 0;
        }
        if (TextOthPass.Text != "")
        {
            dal.TABLE_NAME_TMS_TB_MASTER_COLUMN_OTH_EXP_PASS = int.Parse(TextOthPass.Text.Trim());
        }
        else
        {
            dal.TABLE_NAME_TMS_TB_MASTER_COLUMN_OTH_EXP_PASS = 0;
        }
        if (TxtRemark.Text != "")
        {
            dal.TABLE_NAME_TMS_TB_MASTER_COLUMN_CLM_PASS_REM = TxtRemark.Text.Trim();
        }
        else
        {
            dal.TABLE_NAME_TMS_TB_MASTER_COLUMN_CLM_PASS_REM = "";
        }
        dal.TABLE_NAME_TMS_TB_MASTER_COLUMN_ENTRY_ID = TMSApplicationData.USERID;
        result = bal.UPD_Tour_Travel_Details(dal);       
        if (result == 1)
        {           
            GdvTourDetails.EditIndex = -1;             
            Show_Tour_Travel_Details();   
   Show_Total_Claim_Pass();     
        }
            
       
    }
 private void Show_Total_Claim_Pass()
    {
        bal = new TravelBal();
        dal = new TravelDal();
        ds = new DataSet();
        ds.Clear();
        if (DdlTbNo.Text != "")
        {
            dal.TABLE_NAME_TMS_TRAVEL_ARRANGEMENT_TB_NO = DdlTbNo.Text.Trim();
            ds = bal.Account_Payment_Pass_Details(dal);
            if (ds.Tables[0].Rows.Count > 0)
            {
                TxtEmpNo.Text = ds.Tables[0].Rows[0][0].ToString();
                TxtEmpName.Text = ds.Tables[0].Rows[0][1].ToString();
                TxtFromDate.Text = ds.Tables[0].Rows[0][2].ToString();
                TxtTodate.Text = ds.Tables[0].Rows[0][3].ToString();
                TxtPlaceVisit.Text = ds.Tables[0].Rows[0][4].ToString();
                TxtNoDays.Text = ds.Tables[0].Rows[0][5].ToString();
                TxtTravelPurpose.Text = ds.Tables[0].Rows[0][6].ToString();
                TxtFareClaimed.Text = ds.Tables[0].Rows[0][7].ToString();
                TxtFarePass.Text = ds.Tables[0].Rows[0][8].ToString();
                TxtDAClaimed.Text = ds.Tables[0].Rows[0][9].ToString();
                TxtDAPassed.Text = ds.Tables[0].Rows[0][10].ToString();
                TxtHotClaimed.Text = ds.Tables[0].Rows[0][11].ToString();
                TxtHotelBillPassed.Text = ds.Tables[0].Rows[0][12].ToString();
                TxtConvClaimed.Text = ds.Tables[0].Rows[0][13].ToString();
                TxtConvPassed.Text = ds.Tables[0].Rows[0][14].ToString();
                TxtTaxiHireClaimed.Text = ds.Tables[0].Rows[0][15].ToString();
                TxtTaxiHirePassed.Text = ds.Tables[0].Rows[0][16].ToString();
                TxtOtherExpClaimed.Text = ds.Tables[0].Rows[0][17].ToString();
                TxtOthExpPassed.Text = ds.Tables[0].Rows[0][18].ToString();
                TxtAdvAmountTaken.Text = ds.Tables[0].Rows[0][19].ToString();                
                TMSApplicationData.Orginal_TB_NO = int.Parse(ds.Tables[0].Rows[0][20].ToString());
            }
        }
    }
Answers (1)