D
Darrin
I currently have some code that sends some XML to the USPS website and
returns some XML with shipping costs. I am reading the XML and then binding
it to a dropdownlist. However, I would like to bind two of the XML nodes
(MailService & Rate) as the datatextfield. This way the user will be able to
see the mail service type (standard, prority, etc.) and the rate ($8.00,
$6.00, etc.) Currently I am only able to use one of the XML nodes to bind it
to the drop down list. Does anyone have a sample that would allow me to add
more than one data text field?
XML That is being returned:-----------------------------
<?xml version="1.0" ?>
<RateV2Response>
<Package ID="0">
<ZipOrigination>10022</ZipOrigination>
<ZipDestination>20008</ZipDestination>
<Pounds>10</Pounds>
<Ounces>5</Ounces>
<Container>Flat Rate Box</Container>
<Size>REGULAR</Size>
<Zone>3</Zone>
<Postage>
<MailService>Priority Mail Flat Rate Box (11.25" x 8.75" x 6")</MailService>
<Rate>7.70</Rate>
</Postage>
<Postage>
<MailService>Priority Mail Flat Rate Box (14" x 12" x 3.5")</MailService>
<Rate>7.70</Rate>
</Postage>
</Package>
</RateV2Response>
CODE TO GET XML AND BIND TO DropdownList
--------------------------------------------------------
"strResponseXML"- returned XML as listed above
xmlreader = New XmlTextReader(strResponseXML, XmlNodeType.Document, Nothing)
xmlreader.Read()
Dim ds As New DataSet
ds.ReadXml(xmlreader)
DropDownList1.DataMember = "Postage"
DropDownList1.DataValueField = "Rate"
DropDownList1.DataTextField = "MailService" ''(This is were I would like to
add the Rate value as well.)
DropDownList1.DataSource = ds
DropDownList1.DataBind()
THIS IS WHAT IS CURRENTLY IN THE DROPDOWN
-----------------------------------------------------------
Priority Mail Flat Rate Box (11.25" x 8.75" x 6")
Priority Mail Flat Rate Box (14" x 12" x 3.5")
THIS IS WHAT I AM LOOKING FOR
returns some XML with shipping costs. I am reading the XML and then binding
it to a dropdownlist. However, I would like to bind two of the XML nodes
(MailService & Rate) as the datatextfield. This way the user will be able to
see the mail service type (standard, prority, etc.) and the rate ($8.00,
$6.00, etc.) Currently I am only able to use one of the XML nodes to bind it
to the drop down list. Does anyone have a sample that would allow me to add
more than one data text field?
XML That is being returned:-----------------------------
<?xml version="1.0" ?>
<RateV2Response>
<Package ID="0">
<ZipOrigination>10022</ZipOrigination>
<ZipDestination>20008</ZipDestination>
<Pounds>10</Pounds>
<Ounces>5</Ounces>
<Container>Flat Rate Box</Container>
<Size>REGULAR</Size>
<Zone>3</Zone>
<Postage>
<MailService>Priority Mail Flat Rate Box (11.25" x 8.75" x 6")</MailService>
<Rate>7.70</Rate>
</Postage>
<Postage>
<MailService>Priority Mail Flat Rate Box (14" x 12" x 3.5")</MailService>
<Rate>7.70</Rate>
</Postage>
</Package>
</RateV2Response>
CODE TO GET XML AND BIND TO DropdownList
--------------------------------------------------------
"strResponseXML"- returned XML as listed above
xmlreader = New XmlTextReader(strResponseXML, XmlNodeType.Document, Nothing)
xmlreader.Read()
Dim ds As New DataSet
ds.ReadXml(xmlreader)
DropDownList1.DataMember = "Postage"
DropDownList1.DataValueField = "Rate"
DropDownList1.DataTextField = "MailService" ''(This is were I would like to
add the Rate value as well.)
DropDownList1.DataSource = ds
DropDownList1.DataBind()
THIS IS WHAT IS CURRENTLY IN THE DROPDOWN
-----------------------------------------------------------
Priority Mail Flat Rate Box (11.25" x 8.75" x 6")
Priority Mail Flat Rate Box (14" x 12" x 3.5")
THIS IS WHAT I AM LOOKING FOR