Hello, I have a program that I have written and it works fine, but I am trying to get my dropdownlist to arrange the data alphabetically. When the user searches a number or name in a text box, a dropdownlist is populated with data from a web service. The data is all jumbled up. Any help is very much appreciated. Here's a look at a part of my codes:
protected void Page_Init(object sender, EventArgs e)
{
if (!IsPostBack)
{
string vals = Convert.ToString(Request.Form["txtValues"]);
Service newservice = new Service();
newservice.getStringList(vals);
ddlList.DataSource = PCHS.NameAppealNumber(vals);
ddlList.DataTextField = "Name";
ddlList.DataValueField = "ID";
ddlList.DataBind();
ListItem myitem = new ListItem();
myitem.Text = ".....";
myitem.Value = "";
ddlList.Items.Insert(0, myitem);
ddlList.SelectedIndex = 0;
}
}
protected void Page_Init(object sender, EventArgs e)
{
if (!IsPostBack)
{
string vals = Convert.ToString(Request.Form["txtValues"]);
Service newservice = new Service();
newservice.getStringList(vals);
ddlList.DataSource = PCHS.NameAppealNumber(vals);
ddlList.DataTextField = "Name";
ddlList.DataValueField = "ID";
ddlList.DataBind();
ListItem myitem = new ListItem();
myitem.Text = ".....";
myitem.Value = "";
ddlList.Items.Insert(0, myitem);
ddlList.SelectedIndex = 0;
}
}