private void BindGrid()
        {
            GradeMasterDAL obj         = new GradeMasterDAL();
            var            lstGridData = obj.SelectAll(Convert.ToString(txtGrdName.Text), Convert.ToString(txtAbbr.Text));

            obj = null;
            if (lstGridData != null && lstGridData.Count > 0)
            {
                grdMain.DataSource = lstGridData;
                grdMain.DataBind();

                int startRowOnPage = (grdMain.PageIndex * grdMain.PageSize) + 1;
                int lastRowOnPage  = startRowOnPage + grdMain.Rows.Count - 1;
                lblcontant.Text = "Showing " + startRowOnPage.ToString() + " - " + lastRowOnPage.ToString() + " of " + lstGridData.Count.ToString();

                lblTotalRecord.Text = "T. Record(s): " + lstGridData.Count;
                prints.Visible      = false;
                imgBtnExcel.Visible = false;
                lblcontant.Visible  = true;
                divpaging.Visible   = true;
            }
            else
            {
                grdMain.DataSource = null;
                grdMain.DataBind();
                lblTotalRecord.Text = "T. Record(s): 0 ";
                imgBtnExcel.Visible = false;
                lblcontant.Visible  = false;
                divpaging.Visible   = false;
            }
        }
        private void ExportGridView()
        {
            GradeMasterDAL objcls      = new GradeMasterDAL();
            var            lstGridData = objcls.SelectAll(Convert.ToString(txtGrdName.Text), Convert.ToString(txtAbbr.Text));

            objcls = null;
            grdMain.AllowPaging = false;
            string attachment = "attachment; filename=GradeList.xls";

            Response.ClearContent();
            Response.AddHeader("content-disposition", attachment);
            Response.Charset     = "";
            Response.ContentType = "application/vnd.ms-excel";
            StringWriter   sw  = new StringWriter();
            HtmlTextWriter htw = new HtmlTextWriter(sw);

            grdMain.Columns[3].Visible = false;
            grdMain.Columns[4].Visible = false;
            grdMain.DataSource         = lstGridData;
            grdMain.DataBind();
            grdMain.RenderControl(htw);
            Response.Write(sw.ToString());
            Response.End();
        }