Populate a DropdownList from C# Code

S

Shem

Hi, This is what I have done. It might not be the best way but it worked
first time.
First I created a group called Sponsors with a sub filed called Sponsor
which is repeating. Then in my code (C#) I did.


IXMLDOMNode objRoot; //Holds a copy of the root node to append to
IXMLDOMNode objClone; //Holds a copy of the root node to clone
XmlNodeList objSponsors; //Holds a copy of the node list of data to be
added to
string sSponsorName;
int iLoop = 0;

objRoot = myXDocument.DOM.selectSingleNode("//my:Sponsors");
objClone = myXDocument.DOM.selectSingleNode("//my:Sponsors/my:SponsorName");

objSponsors = thisUser.GetSponsorList(); this was a private call which
reurned the data I wanted to insert in a node list form

foreach (XmlNode objSponsor in objSponsors)
{
iLoop ++;
sSponsorName = objSponsor.Attributes.GetNamedItem("ows_Name").Value;
objClone.text = sSponsorName;

if (iLoop != objSponsors.Count)
{
objRoot.appendChild(objClone.cloneNode(true));
}
}

The dropdown list box data entry then point to //my:Sponsors/my:SponsorName

This should work no problem
 
Top