Skip to content

Data Binding Cheat Sheet

General Form

 

<asp:Label ID="FirstNameLabel" runat="server" Text='<%# Eval("FirstName") %>' />

Note that the quotation marks around first name must be double, so the quotation marks around the whole expression must be single.

Readonly binding to a property of your data object or an indexed default property
<%# Eval("FirstName") %>
Readonly binding to a property of your data object or an indexed default property, with formatting
<%# Eval("FirstName") %>
Read-write binding to property of your data object or an indexed default property
<%# Bind("FirstName") %>
Calling a form member function
<%# Foo(Container.DataItem)%>
Declaring a form member function
Function Foo(ByVal dataItem as Object)
Using Eval in a function
DataBinder.Eval(dataItem, “FirstName”)

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

%d bloggers like this: