Solved

Bind Property to Asp.net textbox

Posted on 2009-05-13
6
667 Views
Last Modified: 2012-05-06
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.
0
Comment
Question by:jpadkins49
  • 4
  • 2
6 Comments
 
LVL 10

Expert Comment

by:MaxOvrdrv2
ID: 24375038
txtbranch.DataSource=UserBranch
0
 
LVL 1

Author Comment

by:jpadkins49
ID: 24375398
Is there a datasource property for textbox controls in asp.net? I do not see one.
0
 
LVL 10

Expert Comment

by:MaxOvrdrv2
ID: 24375939
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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 10

Accepted Solution

by:
MaxOvrdrv2 earned 500 total points
ID: 24375988
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
 
LVL 1

Author Comment

by:jpadkins49
ID: 24430606
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
 
LVL 10

Expert Comment

by:MaxOvrdrv2
ID: 24432302
how do you add the objects that hold the values?
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now