void Student_View_attendance_LoadComplete(object sender, EventArgs e)
    {
        main_class m=new main_class();

        //string student = Session["Student_Username"].ToString();
        string student = "";
        try { student = Session["Student_Username"].ToString(); }
        catch (Exception ex) { Response.Redirect("Student_login.aspx"); }

        int student_id = int.Parse(m.get_idfromusername("student",student).ToString());
        string attn = string.Format("select * from attendence where student_id = {0} ORDER BY attendence_ID DESC ", student_id);
        DataTable dt = m.filldt(attn);

        attendence.DataSource = dt;
        attendence.DataBind();

        int count = 0;

        for (int i = 0; i < attendence.Rows.Count; i++)
        {
            if (attendence.Rows[i].Cells[3].Text == "Present")
            {
                count++;
            }

        }

           int per = (count * 100) / attendence.Rows.Count ;
        percentage.Text = per + " %";
    }
    protected void save_Click(object sender, EventArgs e)
    {
        main_class m = new main_class();

        string img_path = "";

        //Image Upload Code
        if (FileUpload1.HasFile)
        {
            try { System.IO.File.Delete(MapPath(img.ImageUrl)); }
            catch { }
            img_path = "/images/ProfilePic_Student/" + FileUpload1.FileName;
            FileUpload1.SaveAs(MapPath(img_path));

        }
        else
        {
            img_path = img.ImageUrl;
        }

        //
        string username = Session["Student_Username"].ToString();
        int id = m.get_idfromusername("student",username);

        string update = string.Format("update student set fname='{0}',"+
        "mname='{1}',"+
        "lname='{2}',"+
        "email='{3}',"+
        "contactno={4},"+
        "profilepic='{5}',"+
        "school='{6}',"+
        "college='{7}',"+
        "bdate='{8}',"+
        "gender='{9}',"+
        "enrollno='{10}',"+
        "department = '{11}' where student_id = {12}",
        first_name.Text,
        Middle_name.Text,
        last_name.Text,
        mail_id.Text,
        contactno.Text,
        img_path,
        high_school.Text,
        college.Text,
        bdate_date.Text,
        gender.Text,
        enrollmentno.Text,
        department.Text, id );

        m.insertvalues(update);
        m = null;
    }