0

是否可以在 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>
4

2 回答 2

0

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

代替<%# Bind("PlantCode(true)") %>

您可以使用<%# SomeFunc(Bind("PlantCode") %> 并且SomeFunc在这种情况下将使用接受 args 类型的服务器端方法PlantCode

希望能帮助到你!

于 2010-08-05T17:22:27.473 回答
0

你可以这样做:

Text='<%# ((YourObject) Container.DataItem).PlantCode(true) %>'
于 2010-08-05T17:24:23.460 回答