I have a dataset that calls the values from the webservice. In the datasets are abbreivated values (e.g., AA, BB, CC, DD) and I need to display the values on my dropdownlist as its whole names such as AA = APPLE, BB = BEES. Here's is an example of my method.
How can I rename the values in the dataset to what I want?
How can I rename the values in the dataset to what I want?
Code:
DataTable dtEntryInfo = new DataTable();
if (e.Row.RowType == DataControlRowType.Footer)
{
DropDownList ddlABC = (DropDownList)e.Row.FindControl("ddlABC");
DataSet dsABCInfo = new DataSet();
if (ViewState["id"] != null)
{
// call the web service
dsABCInfo = WEBService.ABCDEF((ViewState["ABC"].ToString()));
int cInx = 0;
ddlABC .Items.Clear();
ddlABC .Items.Add(new ListItem("Select", ""));
if (dsABCInfo .Tables["dtABC"].Rows.Count > 0)
{
while (cInx <= dsABCInfo .Tables["dtABC"].Rows.Count - 1)
{
ddlABC .Items.Add(new ListItem(dsABCInfo .Tables["dtABC"].Rows[cInx]["Court"].ToString(),
dsABCInfo .Tables["dtABC"].Rows[cInx]["Court"].ToString()));
cInx = cInx + 1;
}
}