views:

161

answers:

1

I'll try to be more descriptive here.
A Few Q's:

  1. using:
    var foo = new Foo() { Bar = new Bar() { Value = "Value" } };
    var value = DataBinder.Eval(foo, "Bar.Value");

    Or: This one
    It is possible to retrieve an internal nested property using property path syntax. Is there a way to set/trigger a nested property (a regular property not DependencyProperty) easily with some kind of simple mechanisms as described here? I want to acheive something like:
    string newValue = "Hello World!";
    DataBinder.EvalSet(foo, "Bar.Value", NewValue);

  2. Is there any mechanism that support both property path (for nested objects) and XPATHs (if the objects are XPATH navigable of course) ? again, that supports get and set options.

Thanks, DD

A: 

You can use ObjectContainerDataSource from Microsoft practices and patterns to achieve this. Keep in mind that Eval uses reflection and it is better to used ((MyType)Container.DataItem).SomeProperty syntax, if you really want to put this in your aspx. I would go for methods in the code behind that would return what you need. Side note, you are violating a Demeter law here though.

epitka