Sounds like you are asking how does textbox text change when button is clicked.
Well, when button is clicked, page postback happens and event defined if occured executes. Whatever is mentioned in the event method, code executes and one can see the changes on page rendered.
To know the full inner details on how and what happens page flow wise, read: Complete Lifecycle of an ASP.Net page and controls
]ASP.NET Application and Page Life Cycle
]MSDN: ASP.NET Page Life Cycle Overview