// Fetch row data from xml using xml dataset protected void XmlFetchRowData() { string xmlFile = BaseSys.GetXmlFilePath("Contact.xml"); if (File.Exists(xmlFile)) { // Get data from xml file contact.ReadXml(xmlFile); row = (Company.ContactUsRow)contact.Rows[0]; lbContact.Text = string.Format("{0}: {1} | {2}: {3}", Properties.Resources.Phone, row.Phone, Properties.Resources.Fax, row.Fax); lbMobile.Text = string.Format("{0}: {1}", Properties.Resources.Mobile, row.Mobile); lbEmail.Text = string.Format("{0}: {1}", Properties.Resources.Email, row.Email); lbAddress.Text = string.Format("{0}: {1}", Properties.Resources.Address, row.Address); } }
// Save new data to xml file using xml dataset techniques protected bool XmlSaveData() { home.ReadXml(this.xmlFile); row = (Company.ContactUsRow)home.Rows[0]; row.Address = txtAddress.Text; row.Phone = txtPhone.Text; row.Fax = txtFax.Text; row.Mobile = txtMobile.Text; row.Email = txtEmail.Text; try { home.AcceptChanges(); home.WriteXml(this.xmlFile); return true; } catch { return false; } }
// Fetch row data from xml using xml dataset protected void XmlFetchRowData() { if (File.Exists(this.xmlFile)) { // Get data from xml file home.ReadXml(this.xmlFile); row = (Company.ContactUsRow)home.Rows[0]; txtAddress.Text = row.Address; txtPhone.Text = row.Phone; txtFax.Text = row.Fax; txtMobile.Text = row.Mobile; txtEmail.Text = row.Email; } else { BaseSys.ShowMsg(msgPanel, lbMsg, Properties.Resources.XmlFileNotFound, "error"); } }