Databinding: Web Forms vs. Windows Forms

In Windows Forms, all data binding done by the designer is saved as code in the choosen language: C# or VB.NET:

 

//

// dataGrid1

//

this.dataGrid1.DataMember = "Customers";

this.dataGrid1.DataSource = this.dataSet11;

 

On Web Forms, it’s somewhat different, because when binding a DataGrid to a DataTable via designer, the binding isn’t saved as code; instead it’s saved as markup:

 

<asp:DataGrid id=DataGrid1 style="Z-INDEX: 101; LEFT: 16px; POSITION: absolute; TOP: 32px" runat="server" DataSource="<%# dataSet11 %>" DataKeyField="CustomerID" DataMember="Customers" AutoGenerateColumns="False" EnableViewState="False">

      // Column definition

</asp:DataGrid>

 

This entry was posted in Data Binding. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s