I have a gridview that shows data. Data is called from a web service method.In one column, the values are displayed as abbreviation and I need those values displayed as the actual value. I have a Dictionary Object that I want to use to display the values.
Dictionary - where do I put this?
Dictionary - where do I put this?
Code:
Dictionary<string, string> dictionaryABC = new Dictionary<string, string>();
dictionaryABC .Add("AA", "appples");
dictionaryABC .Add("BB", "bananas");
dictionaryABC .Add("CC", "corns");
dictionaryABC .Add("DD", "daisies");
dictionaryABC .Add("EE", "eggs");
dictionaryABC .Add("FF", "fruits");
dictionaryABC .Add("GG", "goats");
Code:
private void GridView()
{
//data table
DataTable dtGridView = new DataTable();
string ID = "";
if (ViewState["id"] != null)
{
ID = ViewState["id"].ToString();
}
//Call web service
dtGridView = WebService.Method(ID);
DataView dv = new DataView(dv);
dv.Sort = "Year desc, Month desc";
dtGridView = dtGridView .ToTable();
if (dtGridView .Rows.Count > 0)
{
gridview.DataSource = dtGridView ;
gridview.DataBind();
}
else
{
dtGridView .Rows.Add(dtGridView .NewRow());
gridview.DataSource = dtGridView .DefaultView;
gridview.DataBind();
}
}