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.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?