jpadkins49
asked on
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.
'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.
txtbranch.DataSource=UserB ranch
ASKER
Is there a datasource property for textbox controls in asp.net? I do not see one.
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?
i don't understand what you're trying to do... you want the text to change on the fly without a post-back?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.
how do you add the objects that hold the values?