Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            String xmlText = "";

            Account acc = new Account();
            acc.Address = "dsdsds";
            acc.Country = "india";
            acc.Id = "12312";
            acc.Name = "pravin";
            acc.Phone = "2323232";
            acc.Sex = "male";

            XmlSerializer ser = new XmlSerializer(acc.GetType());

            StringWriter stringWriter = new StringWriter();

            using (XmlWriter xmlWriter = XmlWriter.Create(stringWriter))
            {
                ser.Serialize(xmlWriter, acc);

            }

            xmlText = stringWriter.ToString();

            UCTest1.SetText(xmlText);
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Account act = new Account();

            act.Id = "T303";
            act.Name = "Girish Baldota";
            act.Address = "Kothrud";
            act.Phone = "9028909925";
            act.Sex = "Male";
            act.Country = "India";

            Literal ltrlTemp = (Literal)this.FindControl("ucProfile1").FindControl("ltrlProfile");
            Hashtable tempHT= ParseXMLtoHT(SerializeObject(act));

            string output="<table border=\"1\">";
            foreach(string keys in tempHT.Keys)
            {
                output = output + "<tr><td>" + keys + "</td><td>" + tempHT[keys] + "</td></tr>";

            }
            output += "</table>";
            ltrlTemp.Text = output;
        }