Jaya Prakash

Jaya Prakash

  • 526
  • 2.3k
  • 59.9k

I am unable to get api value while assigning

Apr 25 2023 11:19 AM

At the line 40 i am trying to assign hdn value to apitype but i am getting null 

 

public void FillPayment(int pageNo)
            {
                try
                {
                    ViewState["CurrentPage"] = pageNo;

                    Reports objReports = new Reports();
                    DataSet dtTransactions = new DataSet();
                    DateTime? fromDate;
                    DateTime? todate;

                    if (txtFromDate.Text == string.Empty)
                    {
                        fromDate = null;
                    }
                    else
                    {
                        fromDate = DateTime.ParseExact(txtFromDate.Text, "yyyy-MM-dd", null);
                    }

                    if (txtToDate.Text == string.Empty)
                    {
                        todate = null;
                    }
                    else
                    {
                        todate = DateTime.ParseExact(txtToDate.Text, "yyyy-MM-dd", null);
                    }
                    objReports.UserID = ouser.UserID;//oUser.UserID;
                    objReports.FromDate_Dt = fromDate;
                    objReports.ToDate_dt = todate;
                    objReports.noOfRecord = Convert.ToInt32(ddl_Choosetop.SelectedItem.Text);
                    objReports.PageNo = pageNo;
                    objReports.Status = 0;
                    objReports.PaymentMethod = "";
                    objReports.SearchTxt = "";
                    objReports.PGType = 2;
                    objReports.Count = ddl_Choosetop.SelectedItem.Text;
                //objReports.Source = ddlsource.SelectedIndex > 0 ? Convert.ToInt32(ddlsource.SelectedItem.Value) : 0; ;
                objReports.APIType = hdnapitype.Value == "PaymentWay" ? "Pay" : "";
                    dtTransactions = oPaymentWayBLL.GetAGTransactions(objReports);

                    if (dtTransactions != null && dtTransactions.Tables.Count > 0)
                    {
                        if (dtTransactions.Tables[1].Rows.Count > 0)
                        {
                            grdAG.DataSource = dtTransactions.Tables[1];
                            grdAG.DataBind();
                            grdAG.FooterRow.Cells[0].Text = "Total";
                            double totamt = Convert.ToDouble(dtTransactions.Tables[0].Rows[0]["TotalAmountPerPage"].ToString());
                            double totcharges = Convert.ToDouble(dtTransactions.Tables[0].Rows[0]["TotalChargesPerPage"].ToString());
                            totamt.ToString("0,0", CultureInfo.CreateSpecificCulture("hi-IN"));
                            totcharges.ToString("0,0", CultureInfo.CreateSpecificCulture("hi-IN"));
                            grdAG.FooterRow.Cells[5].Text = string.Format(india, "{0:c}", totamt);
                            grdAG.FooterRow.Cells[6].Text = string.Format(india, "{0:c}", totcharges);
                            grdAG.FooterRow.Cells[13].Visible = false;
                            ViewState["TotalRecord"] = Convert.ToInt32(dtTransactions.Tables[0].Rows[0]["TotalRecords"]);
                            ViewState["NoOfRecord"] = objReports.noOfRecord;
                            int totrec = Convert.ToInt32(dtTransactions.Tables[0].Rows[0]["TotalRecords"]);
                            this.GetGridDataBasedonPageIndex(totrec, pageNo);
                        }
                        else
                        {
                            grdAG.DataSource = null;
                            grdAG.DataBind();
                            lblentries.Visible = false;
                        }

                    }
                    else
                    {
                        grdAG.DataSource = null;
                        grdAG.DataBind();
                        lblentries.Visible = false;
                    }


                }
                catch (PayException PayException)
                {
                    ScriptManager.RegisterStartupScript(UPDP_AG, UPDP_AG.GetType(), "ErrorMSg", "<script>ShowErrorDialog('" + PayException.Message.ToString() + "')</script>", false);
                }
                catch (Exception ex)
                {

                    oExceptionManager.LogError(ex.Message, " -- In  FillPayment Function in Payment.aspx.cs");
                }
            }

 


Answers (1)