Hello,
In the aspx hostpage codebehind using ...
Dim myUC As New UserControl
myUC = Me.LTUC
Dim myTB As New TextBox
myTB = myUC.FindControl("textbox1")
myTB.Text = Me.FCKeditor1.Value
I can change the text of myTB.text as it is hosted but the changes aren't
persisted. Do I have to use an xml or text file as the source of the
usercontrol's textbox.text property and then write to the text or xml file
using a textwriter? Can't I just update the usercontrol's textbox.text
property directly so that the new value appears with the next instantiation?
Thank you,
Stan - 30 May 2008 11:54 GMT
> Hello,
>
[quoted text clipped - 13 lines]
>
> Thank you,
Hi John
There is an easier way to read and write to the UserControl TextBox
from the host page.
In the VB code for the UserControl itself decare a text property and
link it to the text of the actual control e.g.
public property TheText() as String
Get
return textbox1.text
End Get
Set (ByVal value as string)
textbox1.text = value
End Set
End Property
The content of textbox1 will then be accessible as LTUC.TheText
(It will also appear in the property window of the declared instance
in VS designer and also in the html source code editor as a
recognizable attribute!)
Assuming LTUC is declarative (i.e. declared at design time rather than
programmatically like MyUC) then LTUC.TheText will be preserved by
ViewState because textbox1 in the UserControl is itself declarative.
HTH
John Hopper - 30 May 2008 15:16 GMT
Cool. Thanks!
> > Hello,
> >
[quoted text clipped - 41 lines]
>
> HTH