Help me to clarify User control

G

Guest

Dear all,

I have created a simple user control (server Button) with a public property
define has follow:

Public Property value() As Integer
Get
'return value
Return ViewState("Value")
End Get
Set(ByVal Value As Integer)
ViewState("Value") = Value
End Set
End Property

When user will click on that button it will simply increment the value

Then I drop that user control on a webform, then add to the webform a
textbox that will contain the user control incremented value.

As I ma studying for my asp.net exam, there is one sample in MS press book
saying that in order to retrive the initial text value from the user control,
you need to place following line under the Weform Page_PreRender event, this
because the control is not executed until its container is not fully loaded.
So in that event I add following code :

TextBox1.Text = Spin.value

Note that Spin is declared as follow :
Protected WithEvents Spin As WebUserControl1

Runing that simple sample return an error of time object not defined
Then I set a break point in the Pre_Render event and I can noticed that the
Spin object is set to Nothing

What dis I miss here ?
Does this pre_render is a wrong information ?

thnaks for your help
regards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top