K
Kevin Blount
I'm using the following code to create a DropDownList based on the
contents of a text file, which works. Now I want to add another feature,
which is where I need some guidance.
On one page I present this DropDownList asking people to select a
country, but in another page I want to present the list, with their
previously selected option as the currently selected one. How can I do that?
//COUNTRY LIST SETUP
System.IO.StreamReader countriesSR = new
System.IO.StreamReader(Server.MapPath("/_scripts/resources/" +
pageLanguage + "_countries.txt"));
string nextCountryLine = null;
string nextCountryText = string.Empty;
string nextCountryValue = string.Empty;
while ((nextCountryLine = countriesSR.ReadLine()) != null)
{
string[] countryProperties = new string[2];
countryProperties = nextCountryLine.Split(',');
nextCountryText = countryProperties[0].Trim();
nextCountryValue = countryProperties[1].Trim();
ListItem nextCountryItem = new ListItem(nextCountryText,nextCountryValue);
member_country.Items.Add(nextCountryItem);
}
countriesSR.Close();
TIA
Kevin
contents of a text file, which works. Now I want to add another feature,
which is where I need some guidance.
On one page I present this DropDownList asking people to select a
country, but in another page I want to present the list, with their
previously selected option as the currently selected one. How can I do that?
//COUNTRY LIST SETUP
System.IO.StreamReader countriesSR = new
System.IO.StreamReader(Server.MapPath("/_scripts/resources/" +
pageLanguage + "_countries.txt"));
string nextCountryLine = null;
string nextCountryText = string.Empty;
string nextCountryValue = string.Empty;
while ((nextCountryLine = countriesSR.ReadLine()) != null)
{
string[] countryProperties = new string[2];
countryProperties = nextCountryLine.Split(',');
nextCountryText = countryProperties[0].Trim();
nextCountryValue = countryProperties[1].Trim();
ListItem nextCountryItem = new ListItem(nextCountryText,nextCountryValue);
member_country.Items.Add(nextCountryItem);
}
countriesSR.Close();
TIA
Kevin