ascx用户控件怎么才能双向绑定 象=<%# Bind("日期") %>
<Bindable(True), Category("Data"), Browsable(True), Description("我想绑定它")> _
Public Property selecteddate() As DateTime
Get
If IsDate(TextBox_rq.Text) Then
Return TextBox_rq.Text
Else
Return Nothing
End If
End Get
Set(ByVal value As DateTime)
If IsNothing(value) Then
value = Now.ToShortDateString
End If
TextBox_rq.Text = value.ToShortDateString
Calendar1.SelectedDate = value
Calendar1.VisibleDate = value
End Set
End Property
上向是我做的一个用户控件,可以赋值,取值,但一旦在detailview里采用 =<%# Bind("日期") %>形式就会报错:
Eval()、XPath() 和 Bind() 这类数据绑定方法只能在数据绑定控件的上下文中使用。
请问如何解决,谢谢.