hello ,
i use radGrid in this grid i have GridDropDownColumn column .
in edit mode or insert mode i bound the GridDropDownColumn with list and set text and value for item something like that :-
void Radgrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridEditableItem && (e.Item as GridEditableItem).IsInEditMode)
{
GridEditableItem editedItem = e.Item as GridEditableItem;
GridEditManager editMan = editedItem.EditManager;
GridDropDownColumnEditor editor = editMan.GetColumnEditor("OrganizationName") as GridDropDownColumnEditor;
editor.DataSource = ECMADataManager.GetInstance().Retrieve<Organization>();
editor.DataTextField = "Name";
editor.DataValueField = "OrganizationID";
editor.DataBind();
if ((e.Item.DataItem as EmpEducation) != null)
editor.SelectedValue = (e.Item.DataItem as EmpEducation).OrganizationID.ToString();
}
else if (e.Item is GridDataItem && !e.Item.IsInEditMode)
{
GridDataItem dataItem = (GridDataItem)e.Item;
Literal litrlContrl = (Literal)dataItem["OrganizationName"].Controls[0];
litrlContrl.Text = (e.Item.DataItem as EmpEducation).Organization.Name;
}
}
i want to add a new item in GridDropDownColumnEditor has text"select one" and has no value . so what can i do ???
i use radGrid in this grid i have GridDropDownColumn column .
in edit mode or insert mode i bound the GridDropDownColumn with list and set text and value for item something like that :-
void Radgrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridEditableItem && (e.Item as GridEditableItem).IsInEditMode)
{
GridEditableItem editedItem = e.Item as GridEditableItem;
GridEditManager editMan = editedItem.EditManager;
GridDropDownColumnEditor editor = editMan.GetColumnEditor("OrganizationName") as GridDropDownColumnEditor;
editor.DataSource = ECMADataManager.GetInstance().Retrieve<Organization>();
editor.DataTextField = "Name";
editor.DataValueField = "OrganizationID";
editor.DataBind();
if ((e.Item.DataItem as EmpEducation) != null)
editor.SelectedValue = (e.Item.DataItem as EmpEducation).OrganizationID.ToString();
}
else if (e.Item is GridDataItem && !e.Item.IsInEditMode)
{
GridDataItem dataItem = (GridDataItem)e.Item;
Literal litrlContrl = (Literal)dataItem["OrganizationName"].Controls[0];
litrlContrl.Text = (e.Item.DataItem as EmpEducation).Organization.Name;
}
}
i want to add a new item in GridDropDownColumnEditor has text"select one" and has no value . so what can i do ???