I have a DataSet that contains columns that related to enums in my application. I therefore extended the BoundField control to create a new control EnumBoundField. This will take the integer value开发者_如何学JAVA held in the DataSet and display the description of the enum.
However I would like to add a property to the new control call EnumType and this would be of type System.Type.
e.g.
public Type EnumType{ get; set; }
In my aspx where I define the GridView I would like to use my control like:
<cust:EnumBoundField HeaderText="Status" DataField="statusField" EnumType="<%= typeof(SystemStatus)%>" />
However the above results in the string '<%= typeof(SystemStatus)%>' being passed to my control. Do you know if it is possible to have the the type of Enum passed to the control at run time?
I want to make this control as reusable as possible so that I can reuse it on multiple columns by just passing in a different enum type.
the <%= %> syntax does not work as a databinding expression try <%# %>
精彩评论