Hi there i need help on binding enum to a radgrid.
I have enum below:
<div> <i>public enum UserType</i></div><div><i> {</i></div><div><i> Default = 1, </i></div><div><i> Parameters = 2,</i></div><div><i> Students = 3,</i></div><div><i> Marks = 4,</i></div><div><i> }</i></div> |
and my radgrid defined as follows:
<div><i><telerik:RadGrid id="userGrid" runat="server" AllowFilteringByColumn="false" Width="100%" </i></div><div><i> AutoGenerateColumns="false" PageSize="30" AllowPaging="true"></i></div><div><i> <MasterTableView></i></div><div><i> <Columns></i></div><div><i> <telerik:GridTemplateColumn AllowFiltering="false" Resizable="true" UniqueName="value" HeaderText="Pages"></i></div><div><i> <ItemTemplate></i></div><div><i> <asp:Label ID="asplabelValue" runat="server" ForeColor="Black" Text='<% #Bind("enumValue") %>' Font-Size="Medium"></asp:Label></i></div><div><i> </ItemTemplate></i></div><div><i> </telerik:GridTemplateColumn></i></div><div><i> <telerik:GridTemplateColumn AllowFiltering="false" Resizable="true" UniqueName="pages" HeaderText="Pages"></i></div><div><i> <ItemTemplate></i></div><div><i> <asp:Label ID="aspPgesLabel" runat="server" ForeColor="Black" Font-Size="Medium" Text='<% #Bind("enumText") %>'></asp:Label></i></div><div><i> </ItemTemplate></i></div><div><i> </telerik:GridTemplateColumn></i></div><div><i> </Columns></i></div><div><i> </MasterTableView></i></div><div><i> </telerik:RadGrid></i></div> |
I need to set the datasource of the grid to the enum, and bind the enum name (text) and enum value as shown int he radgrid definition.
Please, someone help me with code snippets that can achieve this.
thanks.