开发者

Bind DetailsView field to Function instead of Property

开发者 https://www.devze.com 2023-01-10 21:41 出处:网络
Is it possible to display the result of a function instead of the value of a property in a DetailsView开发者_开发技巧 Field?

Is it possible to display the result of a function instead of the value of a property in a DetailsView开发者_开发技巧 Field?

For example instead of:

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

maybe something like:

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


You can do this:

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


Yes it is possible to bind the result of a function to a field of DetailsView.

Instead of <%# Bind("PlantCode(true)") %>

you could use <%# SomeFunc(Bind("PlantCode") %> and SomeFunc in this case would a server side method accepting args of type PlantCode.

Hope it helps!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号