protected void ASPxGridView1_HtmlRowPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableRowEventArgs e)
{
if (e.RowType != DevExpress.Web.ASPxGridView.GridViewRowType.Data) return;
int value = (int)e.GetValue("CanBuyNums");
if (value == 0)
{
ASPxButton bt = ASPxGridView1.FindRowCellTemplateControl(e.VisibleIndex, ASPxGridView1.Columns["Operator"] as GridViewDataColumn, "ASPxButton2") as ASPxButton;
bt.Text = "不可卖";
bt.Enabled = false;
}
else
{
ASPxButton bt = ASPxGridView1.FindRowCellTemplateControl(e.VisibleIndex, ASPxGridView1.Columns["Operator"] as GridViewDataColumn, "ASPxButton2") as ASPxButton;
bt.Text = "可卖";
bt.Enabled = true;
}
}
直接贴代码,要注意引用命名空间