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?

  • Are any errors reported? – Mike Smith - MCT - MVP May 4 '18 at 2:28
  • no errors it just won't load into the dropdown list. – prejt May 4 '18 at 16:59
0

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

<fundingSources>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.