Hi Thomas,
Thank you for using MSDN Newsgroup! My name is Steven, and I'll be
assisting you on this issue.
From your description, you'd like to bind a custom object to a ASP.NET
TextBox so as to make them synthronic just like the binding for the winform
TextBox in winform applicaiton.
If there is anything I misunderstood, please feel free to let me know.
As for this question, here is my suggestion on it:
In dotnet, the develop mode and design patterns are quite different between
the winform application and the ASP.NET web applcation.
In winform application, since all the class's instance and resource are all
in memory on a single machine during the runtime. It's ok to bind a control
with a object instance in memory and when the control's value changed, also
synthornize the control with the object instance.
However, in ASP.NET web application(in fact, not only ASP.NET,also for any
other web application). The model is quite different from the winform
application. The enviroment of a web application is distributed, include
the serverside and the clientside. Our ASP.NET applicaiton is running on
the serverside and when a customer request a certain page from his
clientside. The ASP.NET application compiled and executed the page and
output the response html to the client. Then, the connection between client
and the server will be stoped. The customer view the page on the
clientside. So only during the time when the page is executing on the
serverside, there're page's object instances and other custom component
instance in the server memory. We can specify control's data field value at
that time. But after the page is output and sent to client, all the page's
instances in server memory will be cleared.( It's just a page's life cycle
on serverside).
For more detailed info on ASP.NET web page's life cycle and processing, you
may view the follwing article on MSDN:
#Web Forms Page Processing
http://msdn.microsoft.com/library/en-us/vbcon/html/vbconwebformspageprocessi
ngstages.asp?frame=true
Since the different mechanism of web based application, we're not able to
implement the same databind mode as what in winform application in ASP.NET
web application. Also, the ASP.NET web controls has the different internal
mechanism and performance from the winform control. Then on the serverside,
it is constructed as a control objected instance in memory, then, it is
rendered out as html element into response page to the client. In ASP.NET
we use the VIEWSTATE to store the web control's states. But the key point
is when in client side, they are just some html elements doesn't have
memory instance like they are on the serverside. So generally, we set the
controls value and property on serverside before it is sent to clientside.
Also, we retrieve its value when the page is posted back again from client
to the serverside.
For more information on the ASP.NET server control, you may view the below
reference in MSDN:
#Introduction to ASP.NET Server Controls
http://msdn.microsoft.com/library/en-us/vbcon/html/vbconintroductiontowebfor
mscontrols.asp?frame=true
also, here is some web links on web application design patterns which maybe
helpful:
#Web Presentation Patterns
http://msdn.microsoft.com/library/en-us/dnpatterns/html/espwebpresentationpa
tterns.asp?frame=true
Please check out my above suggestions. If you have any questions on it ,
please feel free to let me know.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)