Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
55
Show text portion in instead of numerical of enum in column
posted

I am using ultragrid and I want to show the text portion of a enum property.  I tried doing it like so

 

 

private void MapToLevel()
{
   foreach (var row in HistoryGrid.Rows)
    {
       row.Cells["LevelId"].Value = row.Cells["LevelId"].Value.ToString();
    }
}

this doesn't change anything.

this method is being called here

public new void Refresh()  { LoadData();   HistoryGrid.DataSource = null;   HistoryGrid.DataSource = _BindingSource;   HistoryGrid.DataBind(); MapToLevel(); }

private void LoadData()
{
   _histories = _controller.GetAll(_personId, _companyId);
   _BindingSource = new BindingSource { DataSource = _histories };
}


 

  • 1185
    posted

    I just posted this which may help

    this is for populating a combo box with an enum

    http://forums.infragistics.com/forums/p/68648/347675.aspx#347675

    theres also a link to the original article the work was based on which may help

     

  • 469350
    Suggested Answer
    Offline posted

    Hi,

    I'm afraid I am not sure what you are asking. What do you mean by "text portion"?

    If your column's DataType is an enum, then the code you have here will blow up, because you cannot assign a string to an enum value.

    If you have an Enum type column and you want the column to show the name of the enum instead of the integer value, then the best thing to do is to use a ValueList that maps the enum to the string.