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 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.
eg
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 technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.