private void UpdateExchangeRateFactor()
        {
            if (!string.IsNullOrEmpty(hdnGridRowSelectedPrvious.Value))
            {
                string userCode = WebUtility.HtmlDecode(System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString());
                int    rowIndex = Convert.ToInt32(hdnGridRowSelectedPrvious.Value);

                //Calculate the rowindex for validation
                int rowIndexValidation = (gvExchangeRateDetails.PageIndex * gvExchangeRateDetails.PageSize) + rowIndex;

                Page.Validate("GroupUpdate_" + rowIndexValidation + "");
                if (!Page.IsValid)
                {
                    msgView.SetMessage("Exchange rate factor details not saved – invalid or missing data!", MessageType.Warning, PositionType.Auto);
                    return;
                }

                //int rowIndex = ((GridViewRow)((ImageButton)(e.CommandSource)).NamingContainer).RowIndex;
                string companyCode        = ((HiddenField)gvExchangeRateDetails.Rows[rowIndex].FindControl("hdnCompanyCode")).Value;
                string monthId            = ((HiddenField)gvExchangeRateDetails.Rows[rowIndex].FindControl("hdnMonthId")).Value;
                string exchangeRateFactor = ((TextBox)gvExchangeRateDetails.Rows[rowIndex].FindControl("txtExchangeRateFactor")).Text;

                exchangeRateFactorsBL = new ExchangeRateFactorsBL();
                DataSet updatedData = exchangeRateFactorsBL.UpdateExchangeRateFactor(companyCode, Convert.ToInt32(monthId), Convert.ToDouble(exchangeRateFactor), userCode, out errorId);
                exchangeRateFactorsBL = null;

                if (updatedData.Tables.Count != 0 && errorId != 2)
                {
                    Session["ExchangeRateFactorData"] = updatedData.Tables[0];

                    //WUIN-746 clearing sort hidden files
                    hdnSortExpression.Value = string.Empty;
                    hdnSortDirection.Value  = string.Empty;

                    BindGrid(updatedData.Tables[0]);

                    hdnChangeNotSaved.Value         = "N";
                    hdnGridRowSelectedPrvious.Value = null;
                    msgView.SetMessage("Exchange rate factor details saved successfully.", MessageType.Success, PositionType.Auto);
                }
                else
                {
                    msgView.SetMessage("Failed to save exchange rate factor details.", MessageType.Warning, PositionType.Auto);
                }
            }
        }