devexpress中ASPxGridView控件初始化赋值

写在ASPxGridView中OnCellEditorInitialize="ASPxGridView_progoods_CellEditorInitialize"  事件中:

//(新增时)初始化赋值

protected void ASPxGridView_progoods_CellEditorInitialize(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewEditorEventArgs e)

{

//初始化授权商品名称

if (e.Column.FieldName == "GOODS_ID")

{

DataTable dt = bll.GetList_goods(PEOID.ToString()).Tables[0];

ASPxComboBox cmb1 = e.Editor as ASPxComboBox;

for (int i = 0; i < dt.Rows.Count; i++)

{

cmb1.Items.Add(dt.Rows[i]["GOODSNAME"].ToString(), dt.Rows[i]["GOODS_ID"].ToString());

}

}

//新增时给是否有效字段初始化赋值为‘是’(默认)

if (ASPxGridView_progoods.IsNewRowEditing == true && e.Column.FieldName == "ISVALID")

{

ASPxComboBox cmb2 = e.Editor as ASPxComboBox;

cmb2.SelectedIndex = 1;

}

}

上一篇:IOS 用keychain(钥匙串)保存用户名和密码


下一篇:oracle去掉重复记录语句