I need to take my XML data to populate text boxes
this is what I have.
Code:
ProjectReferralTableControlRow rows = new ProjectReferralTableControlRow();
XmlTextReader obj = new XmlTextReader(@"c:\temp\reg.xml");
string sr= "";
while(obj.Read())
switch (obj.NodeType)
{
case XmlNodeType.Element:
sr = obj.Name;
break;
case XmlNodeType.Text:
//this.SubConstructionManagerLabel1.Text = obj.GetAttribute("BusinessName");
rows.SubConstructionManager1.Text = obj.GetAttribute("BusinessName");
//break;
rows.SubContactName1.Text = obj.GetAttribute("OwnerName");
//break;
rows.SubAddress1.Text = obj.GetAttribute("Address");
// break;
rows.SubCity1.Text = obj.GetAttribute("City");
//break;
rows.SubState1.Text = obj.GetAttribute("State");
// break;
rows.SubZip1.Text = obj.GetAttribute("ZipCode");
// break;
rows.SubPhone1.Text = obj.GetAttribute("Phone");
// break;
rows.SubFax1.Text = obj.GetAttribute("Fax");
//break;
rows.SubEmail1.Text = obj.GetAttribute("Email");
break;
}
}
I am using a table control and repeaters so if I can get this to work.
I can figure out the rest.
My XML file read like this.
Code:
<?xml version="1.0" encoding="utf-8"?><Registration><BusinessName>North Coast Minority Media, LLC</BusinessName><OwnerName>Louis A. Acosta</OwnerName><Address>2310 Superior Avenue, Suite 260</Address><City>Cleveland</City><State>Ohio</State><ZipCode>44114</ZipCode><Phone>4402420835</Phone><Fax>&nbsp;</Fax><EmailAddress>brotherlew@gmail.com</EmailAddress><BusinessName>Bernard R. Doyle dba FASTSIGNS</BusinessName><OwnerName>Mary C. and Bernard Doyle</OwnerName><Address>2102 St. Clair Avenue</Address><City>Cleveland</City><State>Ohio</State><ZipCode>44114</ZipCode><Phone>2165232288</Phone><Fax>2165231265</Fax><EmailAddress>kayandbernard.doyle@fastsigns.com</EmailAddress><BusinessName>DLR Protection</BusinessName><OwnerName>Darren Robinson</OwnerName><Address>16919 Invermere Avenue</Address><City>Cleveland</City><State>Ohio</State><ZipCode>44128</ZipCode><Phone>2169916018</Phone><Fax>2169916085</Fax><EmailAddress>darrenRobinson@roadrunner.com</EmailAddress></Registration>