在使用 DynamicField / DynamicControl 時
The DynamicControl/DynamicField needs to exist inside a data control that is bound to a data source that supports Dynamic Data
中文為
具體發生原因暫時不太清楚
不過
目前我采用的方法
使用這種方法
我分別從DynamicControl 和 DynamicField 繼承了新的類 DdControl 和 DdField
DdControl/DdField的源碼如下
namespace Common
{
public class DdField : DynamicField
{
public override void InitializeCell(System
{
// HACK: Fix bug for: The DynamicControl/DynamicField needs to exist inside a data control that is bound to a data source that supports Dynamic Data
if (base
return;
base
}
}
}
namespace Common
{
public class DdControl : DynamicControl
{
protected override void OnInit(EventArgs e)
{
// HACK: Fix bug for: The DynamicControl/DynamicField needs to exist inside a data control that is bound to a data source that supports Dynamic Data
if (this
base
}
}
}
使用時
就可以直接使用了
<!
<add tagPrefix=
<DetailsView >
<Fields>
<asp:DdField DataField=
</Fields>
</DetailsView>
From:http://tw.wingwit.com/Article/program/net/201311/13365.html