Пример #1
0
        //Bind Grid View
        #region [Bind Grid View]

        private void BindGridView(string feesId)
        {
            try
            {
                EWA_Fees ObjEWA = new EWA_Fees();
                BL_Fees  ObjBL  = new BL_Fees();

                if (!feesId.Equals("Empty"))
                {
                    ObjEWA.FeesId = feesId;
                    DataSet ds = ObjBL.BindGridView_BL(ObjEWA);

                    if (ds != null)
                    {
                        GrdFees.DataSource = ds;
                        GrdFees.DataBind();
                    }
                    else
                    {
                        BindEmptyDataTable();
                    }
                }
                else
                {
                    BindEmptyDataTable();
                }
            }
            catch (Exception exp)
            {
                GeneralErr(exp.Message.ToString());
            }
        }
Пример #2
0
        //Bind Empty Data Table
        #region [Bind Empty Data Table]

        public void BindEmptyDataTable()
        {
            try
            {
                DataTable dtMenu = new DataTable(); //declaringa datatable
                // DataColumn dcMenuID = new DataColumn("SrNo", typeof(System.String));
                // dtMenu.Columns.Add(dcMenuID);// Adding column to the datatable
                DataColumn dcMenuParticular = new DataColumn("Particular", typeof(System.String));

                //creating a column in the same
                //Name of column available in the sql server
                dtMenu.Columns.Add(dcMenuParticular);// Adding column to the datatable
                DataColumn dcMenuAmount = new DataColumn("Amount", typeof(System.String));
                dtMenu.Columns.Add(dcMenuAmount);
                DataColumn dcMenuFeesDetailsId = new DataColumn("FeesDetailsId", typeof(System.Int32));
                dtMenu.Columns.Add(dcMenuFeesDetailsId);
                DataRow datatRow = dtMenu.NewRow();

                //Inserting a new row,datatable .newrow creates a blank row
                dtMenu.Rows.Add(datatRow);//adding row to the datatable

                GrdFees.DataSource = dtMenu;
                GrdFees.DataBind();
                GrdFees.Rows[0].Cells[0].ColumnSpan = GrdFees.Columns.Count;
                GrdFees.Rows[0].Cells[GrdFees.Columns.Count - 1].Visible = false;
                GrdFees.Rows[0].Cells[GrdFees.Columns.Count - 2].Visible = false;
                GrdFees.Rows[0].Cells[GrdFees.Columns.Count - 3].Visible = false;
                GrdFees.Rows[0].Cells[0].Text            = "NO PARTICULARS FOUND";
                GrdFees.Rows[0].Cells[0].HorizontalAlign = HorizontalAlign.Center;
                lblresult.Text = "";
            }
            catch (Exception exp)
            {
                GeneralErr(exp.Message.ToString());
            }
        }