private void CreateAddXml(Academic academic)
        {
            XmlDocument doc = new XmlDocument();

            if (System.IO.File.Exists(filePathForAcaXML))
            {
                doc.Load(filePathForAcaXML);
                XmlNode rootNode = doc.SelectSingleNode("Academic");
                XmlNode addItem  = CreateItemNodeDocUpload(doc, academic);
                rootNode.AppendChild(addItem);
            }
            else
            {
                XmlNode xmldeclerationNode = doc.CreateXmlDeclaration("1.0", "UTF-8", "");
                doc.AppendChild(xmldeclerationNode);
                XmlNode rootNode = doc.CreateElement("Academic");
                XmlNode addItem  = CreateItemNodeDocUpload(doc, academic);
                rootNode.AppendChild(addItem);
                doc.AppendChild(rootNode);
            }

            doc.Save(filePathForAcaXML);

            //LoadGridwithXml();
        }
        protected void btnAddAS_Click(object sender, EventArgs e)
        {
            //if (Session["List"] == null) anAcademic = new List<Academic>();
            //else anAcademic = (List<Academic>)Session["List"];

            Academic academic = new Academic();

            UiDesign();

            if (ValidationSearch())
            {
                academic.strLevelofEducation        = strLevelofEducation.Text;
                academic.strExamDegreeTitle         = strExamDegreeTitle.Text;
                academic.strConcentrationMajorGroup = strConcentrationMajorGroup.Text;
                academic.strInstituteName           = strInstituteName.Text;
                academic.strAchievement             = strAchievement.Text;
                academic.strResult        = strResult.Text;
                academic.strYearofPassing = strYearofPassing.Text;
                academic.strDuration      = strDuration.Text;

                CreateAddXml(academic);

                //anAcademic.Add(academic);
                //dgvOutput.DataSource = anAcademic;
                //dgvOutput.DataBind();
            }
        }
        private XmlNode CreateItemNodeDocUpload(XmlDocument doc, Academic academic)
        {
            XmlNode elementNode = doc.CreateElement("SingleAcademic");

            XmlAttribute LevelofEducation        = doc.CreateAttribute("strLevelofEducation"); LevelofEducation.Value = academic.strLevelofEducation;
            XmlAttribute ExamDegreeTitle         = doc.CreateAttribute("strExamDegreeTitle"); ExamDegreeTitle.Value = academic.strExamDegreeTitle;
            XmlAttribute ConcentrationMajorGroup = doc.CreateAttribute("strConcentrationMajorGroup"); ConcentrationMajorGroup.Value = academic.strConcentrationMajorGroup;
            XmlAttribute InstituteName           = doc.CreateAttribute("strInstituteName"); InstituteName.Value = academic.strInstituteName;
            XmlAttribute Achievement             = doc.CreateAttribute("strAchievement"); Achievement.Value = academic.strAchievement;
            XmlAttribute Result        = doc.CreateAttribute("strResult"); Result.Value = academic.strResult;
            XmlAttribute YearofPassing = doc.CreateAttribute("strYearofPassing"); YearofPassing.Value = academic.strYearofPassing;
            XmlAttribute Duration      = doc.CreateAttribute("strDuration"); Duration.Value = academic.strDuration;

            elementNode.Attributes.Append(LevelofEducation);
            elementNode.Attributes.Append(ExamDegreeTitle);
            elementNode.Attributes.Append(ConcentrationMajorGroup);
            elementNode.Attributes.Append(InstituteName);
            elementNode.Attributes.Append(Achievement);
            elementNode.Attributes.Append(Result);
            elementNode.Attributes.Append(YearofPassing);
            elementNode.Attributes.Append(Duration);

            return(elementNode);
        }