#region 自定义列显示事件
private void gridView1_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
{
#region IsEnable
if (e.Column.FieldName == "IsEnable")
{
if (e.Value != null)
{
int tryId = 0;
bool boolId = int.TryParse(e.Value.ToString().Trim(), out tryId);
if (tryId == 1)
{
e.DisplayText = "启用";
}
else
{
e.DisplayText = "禁用";
}
}
}
#endregion
#region IsLock
if (e.Column.FieldName == "IsLock")
{
if (e.Value != null)
{
int tryId = 0;
bool boolId = int.TryParse(e.Value.ToString().Trim(), out tryId);
if (boolId == true)
{
if (tryId == 1)
{
e.DisplayText = "已锁定";
}
else if (tryId == 0)
{
e.DisplayText = "";
}
}
}
}
#endregion
}
private void gridView1_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
{
#region IsEnable
if (e.Column.FieldName == "IsEnable")
{
if (e.Value != null)
{
int tryId = 0;
bool boolId = int.TryParse(e.Value.ToString().Trim(), out tryId);
if (tryId == 1)
{
e.DisplayText = "启用";
}
else
{
e.DisplayText = "禁用";
}
}
}
#endregion
#region IsLock
if (e.Column.FieldName == "IsLock")
{
if (e.Value != null)
{
int tryId = 0;
bool boolId = int.TryParse(e.Value.ToString().Trim(), out tryId);
if (boolId == true)
{
if (tryId == 1)
{
e.DisplayText = "已锁定";
}
else if (tryId == 0)
{
e.DisplayText = "";
}
}
}
}
#endregion
}