Hi Alfredo,
In fact the DataBinding mode in WebForm is quite different from that in
Winform application. Because the Winform application are running on a
single machine and all the runtime datas are stored and persiste in memory,
so the DataBinding items of the controls are automatically synchronized
with the datasource, we only need to set the datasource but needn't
manually bing them. However, in web application the ASP.NET page is
request/response based, the page object and its contained controls's actual
instance are only existing when the request is processing at serverside.
This is called the web page's lifecycle, after that, the page is rendered
to client, and the page and controls instance's lifecyle end. So those
Page's Serverside events such as Load, PreRender.. are the only place to
set the control's member/property or bind data with them. And the ASP.NET
server control don't have "DataBindings" collection, we set their
databindings via the DataBinding Expression in page template such as
<asp:TextBox id=TextBox1runat="server" Text="<%# expression or function%>" >
</asp:TextBox>
<asp:CheckBox id="CheckBox1" runat="server" Text="<%# expression or
function%>">
</asp:CheckBox>
Then, in page's event such as Page_Load or other event, we can explicitly
call the Control's DataBind() method to fire the DataBinding event of the
control, then it will bind the control's certain property via the above <%#
%> expression set in page template.
Also, we can call Page.DataBind() method, this will make the page to fire
all the controls which has databind expression to bind data.
Here is the reference on web form databinding syntax :
#Data Binding Expression Syntax
http://msdn.microsoft.com/library/en-us/cpgenref/html/cpconDatabindingExpres
sionSyntax.asp?frame=true
Hope also helpful. Thanks.
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.)