Friday, February 11, 2011

Simulating <%#Bind(...) %>

ASP.Net:

In code-behind I can simulate <%# Eval("Property")%> with a call to DataBinder.Eval(myObject,"Property");

How do I simulate a call to <%# Bind("Property")%> ?

many thanks

  • DataBinder.GetPropertyValue(myObject,"Property")

    Richard Nagle : Does this do the two-way data binding in the same way as <%Bind... ?
    Mark Cidade : No. Two-way binding is a bit more complex and is handled internally by the ControlBuilder class which uses the ExpressionBuilderContext, ExpressionBuilder, DataBindingCollection, DataBinding, and BoundPropertyEntry classes to process <%# Bind("Property") %>

0 comments:

Post a Comment