public void Gridauthorbind()
    {
        try
        {
            objauth = new clsLeave();
            objdt   = new DataTable();
            //  objds = new DataSet();
            objauth.Action     = "Grid";
            objauth.SchoolCode = Convert.ToString(Session["SchoolCode"]);
            objauth.UserCode   = Convert.ToString(Session["UserCode"]);
            objdt = objauth.Insert_LeavesDetails();

            if (objdt.Rows.Count > 0)
            {
                if (objdt.Rows[0]["Status1"].ToString() == "Staff")
                {
                    gridAuthor.DataSource = objdt;
                    gridAuthor.DataBind();
                }
                else if (objdt.Rows[0]["Status1"].ToString() == "Co-Ordinator")
                {
                    gridAuthor.DataSource = objdt;
                    gridAuthor.DataBind();
                }
                else
                {
                    gridAuthor.DataSource = objdt;
                    gridAuthor.DataBind();
                }
            }
            else
            {
                gridAuthor.DataSource = null;
                gridAuthor.DataBind();
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
    protected void btnSaveSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            if (validation() == 1)
            {
                objauth = new clsLeave();
                objdt   = new DataTable();
                // objds = new DataSet();

                objauth.SchoolCode = Convert.ToString(Session["SchoolCode"]);
                objauth.UserCode   = Convert.ToString(Session["UserCode"]);
                //  gridrecipt1.

                objauth.type        = rbltype.SelectedValue;
                objauth.Reason_type = txtReason.Text;
                objauth.Co_status   = RblCo.SelectedValue;
                objauth.Prin_Status = RblPri.SelectedValue;

                if (TextBoxFromDate.Text != "")
                {
                    try
                    {
                        objauth.From_Date = Convert.ToDateTime(TextBoxFromDate.Text);
                    }
                    catch (Exception)
                    {
                        objauth.From_Date = DateTime.Parse(TextBoxFromDate.Text);
                    }
                }
                else
                {
                    TextBoxFromDate.Text = "";
                }


                if (TextBoxToDate.Text != "")
                {
                    try
                    {
                        objauth.To_Date = Convert.ToDateTime(TextBoxToDate.Text);
                    }
                    catch (Exception)
                    {
                        objauth.To_Date = DateTime.Parse(TextBoxToDate.Text);
                    }
                }
                else
                {
                    TextBoxToDate.Text = "";
                }



                objauth.Leave_Type         = ddlGame.SelectedValue;
                objauth.Staff_Code         = DDLteacher.SelectedValue;
                objauth.Coordinator_Verify = RblVfy.SelectedValue;

                // objFeePay.BankName = TextBoxBankName.Text;

                if (hdn.Value == "")
                {
                    objauth.Action = "Insert";
                    objdt          = objauth.Insert_LeavesDetails();
                    if (objdt.Rows.Count > 0)
                    {
                        if (objdt.Rows[0][0].ToString() == "1")
                        {
                            ShowMsg("Data Insert Successfully");
                            // Gridauthorbind();
                            DivAddNew.Visible = false;
                            Gridauthorbind();
                            // DivGrid.Visible = true;
                            // Gridauthorbind();
                            //  ButtonAddNew.Visible = true;
                            //  ButtonView.Visible = false;
                            // clear();
                        }
                    }
                }
                else
                {
                    objauth.Action = "Update";
                    objauth.id     = Convert.ToInt32(hdn.Value);
                    objdt          = objauth.Insert_LeavesDetails();

                    if (objdt.Rows.Count > 0)
                    {
                        if (objdt.Rows[0][0].ToString() == "1")
                        {
                            ShowMsg("Data Update Successfully");
                            // clear();
                            DivAddNew.Visible = false;;
                            DivGrid.Visible   = true;
                            Gridauthorbind();
                            // ButtonAddNew.Visible = true;
                            //ButtonView.Visible = false;
                        }
                    }
                }
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }