Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 在DetailsView中对UserControl的属性进行数据绑定_.net_Asp.net_Vb.net_User Controls - Fatal编程技术网

.net 在DetailsView中对UserControl的属性进行数据绑定

.net 在DetailsView中对UserControl的属性进行数据绑定,.net,asp.net,vb.net,user-controls,.net,Asp.net,Vb.net,User Controls,我已经开发了一个usercontrol,但我似乎找不到如何在detailsview中对usercontrol的属性进行数据绑定 属性的定义方式如下: <Bindable(True, BindingDirection.TwoWay)> Public Property Value As String Get Return combobox.SelectedValue End Get Set(value As String) comb

我已经开发了一个usercontrol,但我似乎找不到如何在detailsview中对usercontrol的属性进行数据绑定

属性的定义方式如下:

<Bindable(True, BindingDirection.TwoWay)>
Public Property Value As String
    Get
        Return combobox.SelectedValue
    End Get
    Set(value As String)
        combobox.SelectedValue = value
    End Set
End Property
<myctls:DropDown runat="server" 
                 ID="ctlSupplier" 
                 Value='<%#Bind("supplier_id") %>' />

作为字符串的公共属性值
得到
返回combobox.SelectedValue
结束
设置(值为字符串)
combobox.SelectedValue=值
端集
端属性
我的详细信息视图中的数据绑定是通过以下方式完成的:

<Bindable(True, BindingDirection.TwoWay)>
Public Property Value As String
    Get
        Return combobox.SelectedValue
    End Get
    Set(value As String)
        combobox.SelectedValue = value
    End Set
End Property
<myctls:DropDown runat="server" 
                 ID="ctlSupplier" 
                 Value='<%#Bind("supplier_id") %>' />

无论何时尝试数据绑定,都会出现以下异常:

数据绑定方法,如Eval(), 只能使用XPath()和Bind() 在数据绑定控件的上下文中

有人知道如何在usercontrol的属性上进行数据绑定吗

*编辑1:添加了详细信息viewcode和对象数据源*


[…一堆字段…]
[…一组参数…]
[…其他方法的参数…]
“需要

Imports System.Data

好。。。我知道我可以使用CodeBehind进行数据绑定,但我一直在寻找一种从aspx文件使用数据绑定的解决方案。您的代码也应该可以工作。可能还有别的问题。最后,我发现我的控件中的代码和我的DetailsView之间存在数据绑定冲突。更正错误后,我的数据绑定代码开始工作。