Bind Property to Asp.net textbox

I have a numerous textboxes and controls on my asp.net page. I also have properties that I fill based on the outcome of different class functions. Below is an example of a property in one of the classes of my site:
'User branch property
    Private Branch As String
    Public Property UserBranch() As String
        Get
            Return Branch
        End Get
        Set(ByVal UserBranch As String)
            Branch = UserBranch
        End Set
    End Property
Now, is there a way in asp.net to bind a textbox to this value such as databinding other than using txtbranch.text = userbranch in the page load event. Is there a way to tie this property to this value so that every time the page loads, then it will display the return value from the property. Any help would be greatly appreciated.
LVL 1
jpadkins49Asked:
Who is Participating?
 
MaxOvrdrv2Connect With a Mentor Commented:
you could always define a datasource object, and then on the page load set the text to the datasource... but it's the same thing as calling it directly in the page load.
0
 
MaxOvrdrv2Commented:
txtbranch.DataSource=UserBranch
0
 
jpadkins49Author Commented:
Is there a datasource property for textbox controls in asp.net? I do not see one.
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
MaxOvrdrv2Commented:
no... there is none... my bad... BUT... if you put the txtbranch.Text=UserBranch in the page load, wouldn't that load the text every time?

i don't understand what you're trying to do... you want the text to change on the fly without a post-back?
0
 
jpadkins49Author Commented:
I have set these values to load on the page load event, but they sometimes lose their values on the postback and I am not sure why.
0
 
MaxOvrdrv2Commented:
how do you add the objects that hold the values?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.