0

I'm working with a GridView table and have a dropdown control inside of it. my main task here is create a cascading dropdown with a webpart I'm designing. to that end, the XML file is supposed to supply the values to it.

I have code inside the page load function which is supposed to load the XML file but it always comes up blank and I don't know why.

Here is an example of the C# code:

 DataSet DS = new DataSet(); string physicalPath = HttpContext.Current.Server.MapPath("../FormA/XML-FS.xml"); string webPath = HttpContext.Current.Server.MapPath("http://hsphxvsp2010t:20103/_catalogs/masterpage/XML-FS1.xml"); DS.ReadXml(webPath); ddlFundingSource.DataTextField = "fsName"; ddlFundingSource.DataValueField = "fsID"; //ddlFundingSource.DataSource = DS.Tables[0].DefaultView; ddlFundingSource.DataSource = DS; ddlFundingSource.DataBind(); 

Have tried both path strings, to no avail as well as the XmlDataSource control which is seemingly broken altogether.

and my XML.

<fundingSources> <fundingSource> <fsID>1</fsID> <fsName>NYC</fsName> </fundingSource> <fundingSource> <fsID>2</fsID> <fsName>Upstate</fsName> </fundingSource> <fundingSource> <fsID>3</fsID> <fsName>Adirondacks</fsName> </fundingSource> <fundingSource> <fsID>4</fsID> <fsName>Downstate</fsName> </fundingSource> </fundingSources> 

what is wrong here?

2
  • Are any errors reported?CommentedMay 4, 2018 at 2:28
  • no errors it just won't load into the dropdown list.
    – prejt
    CommentedMay 4, 2018 at 16:59

1 Answer 1

0

If that is your complete XML, then you are missing your start tag and the XML is not well formed.

<fundingSources> 

    Start asking to get answers

    Find the answer to your question by asking.

    Ask question

    Explore related questions

    See similar questions with these tags.