Вопрос

I have a ListView with a LinqDataSource. In the Edit Template we need to edit both the primary object and a related (1 to 1) child object.

In the past I have used code for all of this and manually handled Updates, but I am wondering whether there is a declarative way to get the LinqDataSource to handle it for me.

More specifically:

  1. Is there a way to declaratively bind the child object to our edit inputs and if so what is the sytax?

  2. Is there any way to declaratively bind a LinqDataSource item ("MyLinqObject") to the selected Item/Value of a DropDownList ?

Это было полезно?

Решение

Got this one myself. Child object is simply <%# Bind("MyChildObjectTypeName.MyChildObjectPropertyName") %>'>.

The DropDown question came up because for some reason Intellisense doesn't show a "SelectedValue" property in the DropDownList declaration markup.

Of course, simply adding it anyway works as it should.

SelectedValue='<%# Bind("PropertyName") %>'>
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top