Article information
Article relates to
Q3 2012 SP1
Created by
Stefan Stefanov
Last modified
Dec 15, 2012
Last modified by
Nikolay Diyanov
public
class
FoodType
{
private
int
foodTypeID;
string
foodType;
FoodType(
foodTypeID,
foodType)
this
.foodTypeID = foodTypeID;
.foodType = foodType;
}
FoodTypeID
get
return
foodTypeID; }
set
{ foodTypeID = value; }
FoodTypeName
foodType; }
{ foodType = value; }
Food
foodID;
foodName;
Food(
foodID,
foodName)
.foodID = foodID;
.foodName = foodName;
FoodID
foodID; }
{ foodID = value; }
FoodName
foodName; }
{ foodName = value; }
BindingList<Food> fullList;
BindingList<Food> fruitsList;
BindingList<Food> vegetablesList;
Form1()
InitializeComponent();
fullList =
new
BindingList<Food>();
fullList.Add(
Food(0,
"Onion"
));
Food(1,
"Cucumber"
Food(2,
"Tomato"
Food(3,
"Peach"
Food(4,
"Banana"
Food(5,
"Grape"
fruitsList =
fruitsList.Add(fullList[3]);
fruitsList.Add(fullList[4]);
fruitsList.Add(fullList[5]);
vegetablesList =
vegetablesList.Add(fullList[0]);
vegetablesList.Add(fullList[1]);
vegetablesList.Add(fullList[2]);
BindingList<FoodType> typesList =
BindingList<FoodType>();
typesList.Add(
FoodType(0,
"Vegetables"
FoodType(1,
"Fruits"
GridViewComboBoxColumn foodType =
GridViewComboBoxColumn();
foodType.FieldName =
"FoodType"
;
.radGridView1.Columns.Add(foodType);
foodType.DataSource = typesList;
foodType.Width = 100;
foodType.DisplayMember =
"FoodTypeName"
foodType.ValueMember =
"FoodTypeID"
GridViewComboBoxColumn food =
food.FieldName =
"Food"
.radGridView1.Columns.Add(food);
food.DataSource = fullList;
food.Width = 100;
food.DisplayMember =
"FoodName"
food.ValueMember =
"FoodID"
; }
void
radGridView1_CellEditorInitialized(
object
sender, Telerik.WinControls.UI.GridViewCellEventArgs e)
if
(e.Column.HeaderText ==
)
(
.radGridView1.CurrentRow.Cells[
].Value != DBNull.Value
&&
].Value !=
null
RadDropDownListEditor editor = (RadDropDownListEditor)
.radGridView1.ActiveEditor;
RadDropDownListEditorElement editorElement = (RadDropDownListEditorElement)editor.EditorElement;
.Parse(
].Value.ToString()) == 0)
editorElement.DataSource = vegetablesList;
else
editorElement.DataSource = fruitsList;
editorElement.SelectedValue =
.radGridView1.CurrentCell.Value;
radGridView1_CellValueChanged(
sender, GridViewCellEventArgs e)
e.Row.Cells[
].Value =
Resources Buy Try