This is a migrated thread and some comments may be shown as answers.

Enum for RadGridView

1 Answer 467 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Guarana91
Top achievements
Rank 1
Iron
Iron
Guarana91 asked on 12 Apr 2021, 07:53 AM

Hello,

I am using a RadGridView to show my Data. In this View I have a TextColumn with a Status. Now I want to bind a Enum with this Status to show my Value from the Enum in the RadGridView. My attempt was to define a property to return the StatusStype compared to the Status from my current Item.

But I do not exactly know how to do this. Or is there a better way?

Hope for some help :-)

My View

<telerik:RadGridView ItemsSource="{Binding Items}">
       <telerik:RadGridView.Columns>
         <telerik:TextColumn Header="Document" BindingValue="Document"/>
         <telerik:TextColumn Header="Status" BindingValue="StatusType"/>
       </telerik:RadGridView.Columns>
</telerik:RadGridView>

 

My Enum

public enum StatusTypes
    {
        [Description("Open")]
        Offen = 0,
        [Description("In Process")]
        InProcess = 1,
        [Description("Closed")]
        Closed = 2,
    }

 

My Model

public class MyModel
    {
        public string Document{ get; set; }
  
        public decimal Status { get; set; }
 
        public StatusTypes StatusType
        {
            get
            {
                return Status = StatusTypes
            }
        }

1 Answer, 1 is accepted

Sort by
0
Vladimir Stoyanov
Telerik team
answered on 14 Apr 2021, 12:45 PM

Hello Janko,

Thank you for the shared code snippet. 

Can you check out the following forum thread: GridViewComboBoxColumn with Enums, where a similar question was discussed? 

Note, that the RadGridView does not have a TextColumn. You can take a look at the available columns in its Columns section of the documentation. 

I hope you find this helpful.

Regards,
Vladimir Stoyanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
General Discussions
Asked by
Guarana91
Top achievements
Rank 1
Iron
Iron
Answers by
Vladimir Stoyanov
Telerik team
Share this question
or