protected void btnGetInstituteInfo_Click(object sender, EventArgs e)
        {
            DTOInstituteDetails toins = new DTOInstituteDetails();
            toins.InstituteID = int.Parse(hfInstituteID.Value);
            txtInstituteEmail.Enabled = false;
            btnSave.Enabled = false;
            btnUpdate.Enabled = true;
            btnDelete.Enabled = true;
            DataTable dt = new DataTable();
            dt = new BOInstituteDetails().GetInstituteDetails(toins);
            try
            {
                txtInstituteName.Text = dt.Rows[0][0].ToString();
                txtInstituteEmail.Text = dt.Rows[0][7].ToString();
                Session["LogoPhoto"] = dt.Rows[0][3].ToString();
                imgInstituteLogo.Src = "~/uploaded/" + Session["LogoPhoto"].ToString();
                txtInstituteAddress.Text = dt.Rows[0][1].ToString();
                txtInstitutePhoneNumber.Text = dt.Rows[0][2].ToString();
                txtState.Text = dt.Rows[0][9].ToString();
                txtDistrict.Text = dt.Rows[0][8].ToString();
                txtMaxStudents.Text = dt.Rows[0][10].ToString();

                if (dt.Rows[0][6].ToString().Equals("S"))
                {
                    ddlInstituteType.SelectedIndex = 1;
                }
                else if (dt.Rows[0][6].ToString().Equals("C"))
                {
                    ddlInstituteType.SelectedIndex = 2;
                }
                else if (dt.Rows[0][6].ToString().Equals("D"))
                {
                    ddlInstituteType.SelectedIndex = 3;
                }
                txtPrincipalContactNumber.Text = dt.Rows[0][5].ToString();
                txtPrincipalName.Text = dt.Rows[0][4].ToString();
            }
            catch
            {

            }
        }
        protected void LoginButton_Click(object sender, EventArgs e)
        {
            try
            {
                DTOLogin tologin = new DTOLogin();
                tologin.UserID = UserName.Text;
                tologin.Password = PasswordEncDec.EncodePasswordToBase64(Password.Text);
                bool authenticated = new BOLogin().CheckInstituteUser(tologin);
                if (authenticated)
                {
                    Session["InstituteID"] = new BOInstituteDetails().GetInstituteId(UserName.Text);
                    Session["UserName"] = UserName.Text;

                    DTOInstituteDetails toins = new DTOInstituteDetails();
                    toins.InstituteEmail = Session["UserName"].ToString();
                    toins.InstituteID = int.Parse(Session["InstituteID"].ToString());

                    DataTable dt = new BOInstituteDetails().GetInstituteDetails(toins);

                    Session["LogoPath"] = dt.Rows[0][3].ToString();
                    Session["InstituteName"] = dt.Rows[0][0].ToString();
                    Session["InstituteType"] = dt.Rows[0][6].ToString();
                    Session["MaxStudentsInstitute"] = dt.Rows[0][10].ToString();

                    Response.Redirect("InstituteDefault.aspx");
                }
                else
                {
                    FailureText.Text = "Username or Password is incorrect.";
                }

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
 private void RefreshGridView()
 {
     DataTable dt = new BOInstituteDetails().GetFilteredInstitutes(txtInstituteName.Text, txtDistrict.Text, txtState.Text);
     gvInstitutes.DataSource = dt;
     gvInstitutes.DataBind();
 }