Hi i have been struggling to create a web app that has a
dropdown list which contains a few xml files, when selecting one it should display that xml file in a control. it also needs to have a button to update that xml file and save it.
My code:
DirectoryInfo dirInfo = new DirectoryInfo(Server.MapPath("/ZoneScripts"));
FileInfo[] fileList = dirInfo.GetFiles();
foreach (FileInfo fileInfo in fileList)
{
dropdownlist.Items.Add(new ListItem(fileInfo.Name, fileInfo.Name));
}
This is the load script method // loading the scrip from file
public void LoadScript()
{
string scriptpath = Server.MapPath("/ZoneScripts/" + dropdownlist.SelectedValue.ToString());
ZoneScript myscript = new ZoneScript(scriptpath);
myscript = myscript.LoadFile();
if ( myScript.greeting != null )
if ( myScript.idVerification != null )
if ( myScript.delivery != null )
and so on displaying the xml file in a control..
}
I then have a button DisplayScripts()// when i click the button the xml script that is selected from the dropdown will be displayed in the textboxes
protected void btnDisplayScript_Click( object sender, EventArgs e )
{
Loadscript();
}
below is an example of one of my xml files
<ZoneScript xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<greeting>
<data>Good Day my name is (var)operationsuser.firstName(/var) (var)operationsuser.surname(/var).May I please speak to (var)deliveryconsolidation.ConsigneeName(/var)?</data>
<data>I am calling to confirm your order( (var)customercardproducttype.descriptions(/var) card ) </data>
<data></data>
</greeting>
<idVerification>
<data>(var)DeliveryConsolidation.consigneename(/var), before we proceed with the delivery arrangements, could you please confirm your initials in your id book as it has to correspond to what we received from the bank.</data>
<data></data>
<fullIdCheck>
<data>(var)DeliveryConsolidation.consigneename(/var) for security purposes would you please confirm your identity number.</data>
<data></data>
</fullIdCheck>
<defaultIdCheck>
<data>(var)DeliveryConsolidation.consigneename(/var) for security purposes would you please confirm your date of birth.</data>
<data></data>
</defaultIdCheck>
</idVerification>
<delivery>
<data>I would like to arrange the delivery of your order either tomorrow or on a date convenient to you.</data>
<data></data>
</delivery>
<ficaRequired>
<Title>Documents Required</Title>
<data>(var)DeliveryConsolidation.consigneename(/var) can you please have the following documents ready for the driver upon delivery.</data>
<data></data>
<ficaTypes>
<ficaType ficaName="original ID and Copy Of ID" banks="ALL">
<data>(var)DeliveryConsolidation.consigneename(/var) please make sure that your eyes, nose, mouth and chin are clearly visible</data>
<data></data>
</ficaType>
<ficaType ficaName="Proof Of Residence not older than 3 months" banks="MGSA STDC BARC FNBC NEDC ABSA VMSA BCSA">
<data>(var)DeliveryConsolidation.consigneename(/var), please ensure that the initials on your proof of residence correspond with the initials in your id document and that it has the same street name, suburb and postal code you provided to the bank, or we will not be able to deliver your credit card.</data>
<data>All proof of residence posted to a P.O.Box will not be accepted.</data>
<data>IF:</data>
<data>Co-Habitant:(var)DeliveryConsolidation.consigneename(/var) could you please get a written affidavit from the OWNER signed in front of a commissioner of oath? (Owner must also give proof of residence, relationship must be stated in affidavit and your id number and owner's id number must appear in the affidavit.)</data>
<data>Where Client supplies 'Lease/Rental Agreement': Must be the entire agreement, initialled on every page by the client and stamped and signed by the driver.</data>
<data></data>
</ficaType>
<ficaType ficaName="Copy of Proof Of Income not older than 3 months" banks="MGSA ABSA VMSA BCSA">
<data>(var)DeliveryConsolidation.consigneename(/var) are you a commission earner?</data>
<data>YES: (var)DeliveryConsolidation.consigneename(/var), could you please prepare copies of the last 3 months bankstatements/payslips or 1 payslip indicating the progressive taxable income( not older than 3 months), with your name and surname on it?</data>
<data>NO: (var)DeliveryConsolidation.consigneename(/var), could you please prepare copies of the last 3 months bankstatements or a copy of your payslip, not older than 3 months, with your name and surname on it?</data>
<data></data>
</ficaType>
</ficaTypes>
</ficaRequired>
<title>Zone Control Guide</title>
<ficaExample>
<ficaTypes>
<ficaType ficaName="Examples of Proof Of Residence" banks="ALL">
<data>(Bankstatements from another bank less than 3 months old )</data>
<data>(Municipal rates and taxes invoice less than 3 months old )</data>
<data>(Telkom or cell phone account less than 3 months old )</data>
<data>(Offical SARS document less than 1 year old )</data>
<data>(Recent/long term insurance policy documents )</data>
</ficaType>
</ficaTypes>
</ficaExample>
<ending>
<data>
(var)DeliveryConsolidation.consigneename(/var), if you are unsure about any of the FICA requirements for your (var)customercardproducttype.descriptions(/var) card, you can contact ABSA on the following number for clarification, 012-317-3323.
</data>
<data></data>
<data>(var)DeliveryConsolidation.consigneename(/var) my driver will give you a call half an hour before delivering the card to you. Which number would you like him to call you on?</data>
<finalEndings>
<string>(var)DeliveryConsolidation.consigneeContact(/var) thank you for your time. Good day.</string>
</finalEndings>
<Title>Confirm All Special Instructions</Title>
</ending>
</ZoneScript>