Asp.net 将DetailsView字段绑定到函数而不是属性

Asp.net 将DetailsView字段绑定到函数而不是属性,asp.net,data-binding,detailsview,Asp.net,Data Binding,Detailsview,是否可以在DetailsView字段中显示函数的结果而不是属性的值 例如,而不是: <asp:Label ID="m_LabelPlantCode" runat="server" Text='<%# Bind("PlantCode") %>'></asp:Label> 可能是这样的: <asp:Label ID="m_LabelPlantCode" runat="server" Text='<%# Bind("PlantCode(true)"

是否可以在DetailsView字段中显示函数的结果而不是属性的值

例如,而不是:

<asp:Label ID="m_LabelPlantCode" runat="server" Text='<%# Bind("PlantCode") %>'></asp:Label>

可能是这样的:

<asp:Label ID="m_LabelPlantCode" runat="server" Text='<%# Bind("PlantCode(true)") %>'></asp:Label>

是可以将函数结果绑定到DetailsView字段

而不是

您可以使用
SomeFunc
在这种情况下,服务器端方法将接受类型为
PlantCode
的参数

希望有帮助

您可以这样做:

Text='<%# ((YourObject) Container.DataItem).PlantCode(true) %>'
Text=''