protected void btngo_Click(object sender, EventArgs e)
    {
        try
        {
            if (txtbatch.Text != "--Select--" || chklsbatch.Items.Count != null)
            {
                int itemcount = 0;


                for (itemcount = 0; itemcount < chklsbatch.Items.Count; itemcount++)
                {
                    if (chklsbatch.Items[itemcount].Selected == true)
                    {
                        if (sqlbatch == "")
                        {
                            sqlbatch = "'" + chklsbatch.Items[itemcount].Value.ToString() + "'";
                        }
                        else
                        {
                            sqlbatch = sqlbatch + "," + "'" + chklsbatch.Items[itemcount].Value.ToString() + "'";
                        }
                    }
                }


                if (sqlbatch != "")
                {
                    sqlbatch      = " in(" + sqlbatch + ")";
                    sqlbatchquery = " and r.batch_year  " + sqlbatch + "";
                }
                else
                {
                    sqlbatchquery = " ";
                }
            }

            if (txtdegree.Text != "---Select---" || chklstdegree.Items.Count != null)
            {
                int itemcount = 0;


                for (itemcount = 0; itemcount < chklstdegree.Items.Count; itemcount++)
                {
                    if (chklstdegree.Items[itemcount].Selected == true)
                    {
                        if (strdegree == "")
                        {
                            strdegree = "'" + chklstdegree.Items[itemcount].Value.ToString() + "'";
                        }
                        else
                        {
                            strdegree = strdegree + "," + "'" + chklstdegree.Items[itemcount].Value.ToString() + "'";
                        }
                    }
                }

                if (strdegree != "")
                {
                    sqldegree = " in(" + strdegree + ")";
                    sqldegree = " and r.degree_code  " + strdegree + "";
                }
                else
                {
                    sqldegree = " ";
                }
            }

            if (txtbranch.Text != "---Select---" || chklstbranch.Items.Count != null)
            {
                int itemcount = 0;


                for (itemcount = 0; itemcount < chklstbranch.Items.Count; itemcount++)
                {
                    if (chklstbranch.Items[itemcount].Selected == true)
                    {
                        if (sqlbranch == "")
                        {
                            sqlbranch = "'" + chklstbranch.Items[itemcount].Value.ToString() + "'";
                        }
                        else
                        {
                            sqlbranch = sqlbranch + "," + "'" + chklstbranch.Items[itemcount].Value.ToString() + "'";
                        }
                    }
                }

                if (sqlbranch != "")
                {
                    sqlbranch      = " in(" + sqlbranch + ")";
                    sqlbranchquery = " and r.degree_code  " + sqlbranch + "";
                }
                else
                {
                    sqlbranchquery = " ";
                }
            }

            if (txtsec.Text != "---Select---" || chklssec.Items.Count != null)
            {
                int itemcount = 0;

                int cnt = 0;
                for (itemcount = 0; itemcount < chklssec.Items.Count; itemcount++)
                {
                    if (chklssec.Items[itemcount].Selected == true)
                    {
                        cnt++;
                        if (sqlsec == "")
                        {
                            sqlsec = "'" + chklssec.Items[itemcount].Value.ToString() + "'";
                        }
                        else
                        {
                            sqlsec = sqlsec + "," + "'" + chklssec.Items[itemcount].Value.ToString() + "'";
                        }
                    }
                }

                if (cnt == chklssec.Items.Count)
                {
                    if (sqlsec == "")
                    {
                        sqlsec = "''";
                    }
                    else
                    {
                        sqlsec = sqlsec + "," + "''";
                    }
                }

                if (sqlsec != "")
                {
                    sqlsec      = " in(" + sqlsec + ")";
                    sqlsecquery = " and isnull(r.sections,'')  " + sqlsec + "";
                }
                else
                {
                    sqlsecquery = " ";
                }
            }
            studtype = ddlstutype.Text;//added by rajasekar 10/09/2018


            if (sqldegree != " " || sqlbranchquery != " ")
            {
                Fpstudenttransport.Visible                        = true;
                Fpstudenttransport.Sheets[0].RowCount             = 0;
                Fpstudenttransport.Sheets[0].ColumnCount          = 0;
                Fpstudenttransport.Sheets[0].ColumnHeader.Visible = true;
                Fpstudenttransport.Sheets[0].ColumnCount++;

                Fpstudenttransport.Sheets[0].AutoPostBack          = true;
                Fpstudenttransport.Sheets[0].ColumnHeader.RowCount = 1;
                Fpstudenttransport.Sheets[0].ColumnCount           = 11;
                Fpstudenttransport.Sheets[0].RowCount = 0;
                Fpstudenttransport.Sheets[0].PageSize = 5000;

                ds2.Dispose();
                ds2.Reset();
                ds2 = d2.Bindstudenttransport(sqlbatchquery, sqlbranchquery, sqlsecquery, studtype);//modified by rajasekar 10/09/2018
                if (ds2.Tables[0].Rows.Count > 0)
                {
                    errmsg.Visible             = false;
                    lblnorec.Visible           = false;
                    Fpstudenttransport.Visible = true;
                    //btnxl.Visible = true;
                    //btnprintmaster.Visible = true;

                    Fpstudenttransport.Sheets[0].ColumnHeader.Cells[0, 0].Text  = "S.No";
                    Fpstudenttransport.Sheets[0].ColumnHeader.Cells[0, 1].Text  = "Roll No";
                    Fpstudenttransport.Sheets[0].ColumnHeader.Cells[0, 2].Text  = "Reg No";
                    Fpstudenttransport.Sheets[0].ColumnHeader.Cells[0, 3].Text  = "Student Name";
                    Fpstudenttransport.Sheets[0].ColumnHeader.Cells[0, 4].Text  = "Gender";
                    Fpstudenttransport.Sheets[0].ColumnHeader.Cells[0, 5].Text  = "Student Type";
                    Fpstudenttransport.Sheets[0].ColumnHeader.Cells[0, 6].Text  = "Route";
                    Fpstudenttransport.Sheets[0].ColumnHeader.Cells[0, 7].Text  = "Transport No";
                    Fpstudenttransport.Sheets[0].ColumnHeader.Cells[0, 8].Text  = "Starting Point";
                    Fpstudenttransport.Sheets[0].ColumnHeader.Cells[0, 9].Text  = "Hostel Name";
                    Fpstudenttransport.Sheets[0].ColumnHeader.Cells[0, 10].Text = "Room No";


                    Fpstudenttransport.Sheets[0].Columns[0].Width  = 50;
                    Fpstudenttransport.Sheets[0].Columns[1].Width  = 150;
                    Fpstudenttransport.Sheets[0].Columns[2].Width  = 150;
                    Fpstudenttransport.Sheets[0].Columns[3].Width  = 250;
                    Fpstudenttransport.Sheets[0].Columns[4].Width  = 80;
                    Fpstudenttransport.Sheets[0].Columns[5].Width  = 120;
                    Fpstudenttransport.Sheets[0].Columns[6].Width  = 50;
                    Fpstudenttransport.Sheets[0].Columns[7].Width  = 50;
                    Fpstudenttransport.Sheets[0].Columns[8].Width  = 80;
                    Fpstudenttransport.Sheets[0].Columns[9].Width  = 200;
                    Fpstudenttransport.Sheets[0].Columns[10].Width = 80;

                    int sno = 0;
                    for (int rolcount = 0; rolcount < ds2.Tables[0].Rows.Count; rolcount++)
                    {
                        sno++;
                        Fpstudenttransport.Sheets[0].RowCount = Fpstudenttransport.Sheets[0].RowCount + 1;
                        Fpstudenttransport.Sheets[0].Rows[Fpstudenttransport.Sheets[0].RowCount - 1].Font.Bold            = false;
                        Fpstudenttransport.Sheets[0].Cells[Fpstudenttransport.Sheets[0].RowCount - 1, 0].Text             = Convert.ToString(sno);
                        Fpstudenttransport.Sheets[0].Cells[Fpstudenttransport.Sheets[0].RowCount - 1, 0].HorizontalAlign  = HorizontalAlign.Center;
                        Fpstudenttransport.Sheets[0].Cells[Fpstudenttransport.Sheets[0].RowCount - 1, 1].Text             = ds2.Tables[0].Rows[rolcount]["Roll_No"].ToString();
                        Fpstudenttransport.Sheets[0].Cells[Fpstudenttransport.Sheets[0].RowCount - 1, 1].HorizontalAlign  = HorizontalAlign.Left;
                        Fpstudenttransport.Sheets[0].Cells[Fpstudenttransport.Sheets[0].RowCount - 1, 2].CellType         = new FarPoint.Web.Spread.TextCellType();
                        Fpstudenttransport.Sheets[0].Cells[Fpstudenttransport.Sheets[0].RowCount - 1, 2].Text             = ds2.Tables[0].Rows[rolcount]["Reg_No"].ToString();;
                        Fpstudenttransport.Sheets[0].Cells[Fpstudenttransport.Sheets[0].RowCount - 1, 2].HorizontalAlign  = HorizontalAlign.Left;
                        Fpstudenttransport.Sheets[0].Cells[Fpstudenttransport.Sheets[0].RowCount - 1, 3].Text             = ds2.Tables[0].Rows[rolcount]["Stud_Name"].ToString();
                        Fpstudenttransport.Sheets[0].Cells[Fpstudenttransport.Sheets[0].RowCount - 1, 3].HorizontalAlign  = HorizontalAlign.Left;
                        Fpstudenttransport.Sheets[0].Cells[Fpstudenttransport.Sheets[0].RowCount - 1, 4].Text             = ds2.Tables[0].Rows[rolcount]["Gender"].ToString();
                        Fpstudenttransport.Sheets[0].Cells[Fpstudenttransport.Sheets[0].RowCount - 1, 4].HorizontalAlign  = HorizontalAlign.Left;
                        Fpstudenttransport.Sheets[0].Cells[Fpstudenttransport.Sheets[0].RowCount - 1, 5].Text             = ds2.Tables[0].Rows[rolcount]["Stud_Type"].ToString();
                        Fpstudenttransport.Sheets[0].Cells[Fpstudenttransport.Sheets[0].RowCount - 1, 5].HorizontalAlign  = HorizontalAlign.Left;
                        Fpstudenttransport.Sheets[0].Cells[Fpstudenttransport.Sheets[0].RowCount - 1, 6].Text             = ds2.Tables[0].Rows[rolcount]["Bus_RouteID"].ToString();
                        Fpstudenttransport.Sheets[0].Cells[Fpstudenttransport.Sheets[0].RowCount - 1, 6].HorizontalAlign  = HorizontalAlign.Center;
                        Fpstudenttransport.Sheets[0].Cells[Fpstudenttransport.Sheets[0].RowCount - 1, 7].Text             = ds2.Tables[0].Rows[rolcount]["VehID"].ToString();
                        Fpstudenttransport.Sheets[0].Cells[Fpstudenttransport.Sheets[0].RowCount - 1, 7].HorizontalAlign  = HorizontalAlign.Center;
                        Fpstudenttransport.Sheets[0].Cells[Fpstudenttransport.Sheets[0].RowCount - 1, 8].Text             = ds2.Tables[0].Rows[rolcount]["Boarding"].ToString();
                        Fpstudenttransport.Sheets[0].Cells[Fpstudenttransport.Sheets[0].RowCount - 1, 8].HorizontalAlign  = HorizontalAlign.Left;
                        Fpstudenttransport.Sheets[0].Cells[Fpstudenttransport.Sheets[0].RowCount - 1, 9].Text             = ds2.Tables[0].Rows[rolcount]["Hostel_Name"].ToString();
                        Fpstudenttransport.Sheets[0].Cells[Fpstudenttransport.Sheets[0].RowCount - 1, 9].HorizontalAlign  = HorizontalAlign.Left;
                        Fpstudenttransport.Sheets[0].Cells[Fpstudenttransport.Sheets[0].RowCount - 1, 10].Text            = ds2.Tables[0].Rows[rolcount]["Room_Name"].ToString();
                        Fpstudenttransport.Sheets[0].Cells[Fpstudenttransport.Sheets[0].RowCount - 1, 10].HorizontalAlign = HorizontalAlign.Left;
                    }
                }
                else
                {
                    lblnorec.Visible           = true;
                    Fpstudenttransport.Visible = false;
                    //btnxl.Visible = false;
                    //btnprintmaster.Visible = false;
                }
            }
            else
            {
                Fpstudenttransport.Visible = false;
                errmsg.Visible             = true;
                errmsg.Text = "Please Select Branch and Degree";
            }
        }
        catch (Exception ex)
        {
            errmsg.Text = ex.ToString();
        }
    }