protected void BindAssignedOperator()
        {
            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@OPR", "2"),
                new SqlParameter("@PlantCode", drpPlantCode.SelectedIndex == 0 ? "" : drpPlantCode.SelectedItem.Text.Trim()),
                new SqlParameter("@Line", drpLine.SelectedIndex == 0 ? "" : drpLine.SelectedItem.Text.Trim()),
                new SqlParameter("@ShiftCode", drpShift.SelectedIndex == 0 ? "" : drpShift.SelectedItem.Text.Trim()),
                new SqlParameter("@StationCode", drpStationCode.SelectedIndex == 0 ? "" : drpStationCode.SelectedValue.Trim()),
                new SqlParameter("@OperatorName", txtOperator.Text.Trim()),
                new SqlParameter("@Type", drpAOType.SelectedIndex == 0 ? "" : drpAOType.SelectedItem.Text.Trim()),
                new SqlParameter("@ShiftFromDate", txtShiftFromDate.Text.Trim()),
                new SqlParameter("@ShiftToDate", txtShiftToDate.Text.Trim()),
                new SqlParameter("@CreatedFromDate", txtCreatedFromDate.Text.Trim()),
                new SqlParameter("@CreatedToDate", txtCreatedToDate.Text.Trim()),
                new SqlParameter("@CreatedBy", CreatedBy.Text.Trim()),
                new SqlParameter("@edp", txtedp1.Text.Trim())
            };

            DataTable Dt = new DataTable();

            Dt = DBClass.GetDatatable_WithParam(param, "DM_SP_ADD_ASSIGNED_OPERATOR_DATA");
            GVAssignedOperator.DataSource = Dt;
            GVAssignedOperator.DataBind();
        }
        private void ExportGridToExcel()
        {
            Response.Clear();
            Response.Buffer = true;
            Response.ClearContent();
            Response.ClearHeaders();
            Response.Charset = "";
            GVAssignedOperator.AllowPaging = false;
            //gvInvoiceDetails.Columns[10].Visible = false;
            //gvInvoiceDetails.Columns[11].Visible = false;
            //gvInvoiceDetails.Columns[12].Visible = false;
            // FillGrid();
            BindAssignedOperator();
            string         FileName       = "AssignedOperatorDetails_" + DateTime.Now + ".xlsx";
            StringWriter   strwritter     = new StringWriter();
            HtmlTextWriter htmltextwrtter = new HtmlTextWriter(strwritter);

            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.ContentType = "application/vnd.ms-excel";
            Response.AddHeader("Content-Disposition", "attachment;filename=" + FileName);
            GVAssignedOperator.Columns[0].Visible    = false;
            GVAssignedOperator.Columns[11].Visible   = false;
            GVAssignedOperator.Columns[12].Visible   = false;
            GVAssignedOperator.GridLines             = GridLines.Both;
            GVAssignedOperator.HeaderStyle.Font.Bold = true;
            GVAssignedOperator.RenderControl(htmltextwrtter);
            Response.Write(strwritter.ToString());
            Response.End();
        }