Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / December 2007

Tip: Looking for answers? Try searching our database.

Property

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
shapper - 20 Dec 2007 00:57 GMT
Hello,

I created a custom control as follows:

 Public Class Field
   Inherits Control
   Implements INamingContainer

   Protected Overrides Sub CreateChildControls()
     MyBase.Controls.Add(tbInput)
     MyBase.CreateChildControls()
     Me.ChildControlsCreated = True
   End Sub

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

   Private Sub tbInput_Init(ByVal sender As Object, ByVal e As
EventArgs) Handles tbInput.Init
       tbInput.Text = Me.Value
   End Sub

 End Class

I added this control to a web page in Page_Init event.
In the control Init event I defined its value as "Initial Value"

I then added a button to a page:

 Private Sub bSubmit_Click(ByVal sender As Object, ByVal e As
EventArgs) Handles bSubmit.Click
   Response.Write(MyField.Value.ToString)
 End Sub

When I click this button the value displayed is always "Initial Value"
even when it was changed.
And after the PostBack the value in the text box changes again Initial
Value.

Any idea what I am doing wrong?

Thanks,
Miguel
shapper - 21 Dec 2007 19:33 GMT
> Hello,
>
[quoted text clipped - 45 lines]
>
> Thanks,Miguel

Anyone?

Thanks,
Miguel

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.