views:

23

answers:

2

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>
A: 

Hi,

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!

Vaibhav
A: 

You can do this:

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