I'm not sure what i'm doing wrong:
<uc1:webusercontrol id="WebUserControl1" runat="server" uctextbox='<%#
"GetTime()" %>'></uc1:webusercontrol>
defined on the .aspx:
Public Function GetTime() As String
Return DateTime.Now.ToString("T")
End Function
defined on the control page:
Public Property UcTextBox() As String
Get
Return Me.TextBox1.Text
End Get
Set(ByVal value As String)
Me.TextBox1.Text = value
End Set
End Property
And the result is that nothing shows up in the textbox.
Eliyahu Goldin said:
Something like this?
public string TextBinding
{
set
{
myText.Text = value;
myText.DataBind();
}
}
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
yes, i've exposed public properties in a user control but which one do
i
expose in this case. i couldn't find the DataBindings.Add for the
textbox
in
my user control (with the context of being in the user control
designer).
i guess what i'm asking is what public property do i expose on the user
control and how do i set it?
thanks,
rodchar
:
User control can expose properties. You can make a property that will
set
the binding expression. Is it what you are after?
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
hey all,
for simplicity's sake i have a single textbox inside a user control.
once
i
drag that user control onto my page is there a way to attach a
binding
expression to it at runtime?
thanks,
rodchar