通常,对于DropDownList采用DataValueField, DataTextField
这两属性进行数据的绑定设置。但是这两个属性需要数据源的属性(只能是属性),
如果是数据源的字段,请问该怎样设置。
在Repeater空间的数据绑定中通过函数:
1<td>```
2# someFun(Container.DataItem,"name")
3```</td>
可以实现绑定字段,但是在dropdownlist,采用同样的方式绑定两个属性会错。
我不知道该怎么办?
请教?
---------------------------------------------------------------
it is true, then you cannot use databinding, but you can alawys do
for(int i=0; i < YourObjectList.Length; i++)
{
YourDropDownList.Items.Add(new ListItem(YourObjectList[i].Field1, YourObjectList[i].Field2));
}