ASP. NET data binding (1)

Source: Internet
Author: User

ASP.. NET data binding must be activated once specified. You can use the DataBind method to activate it. Note that the DataBind method must be called in the Load event; otherwise, ASP.. NET will ignore the data binding expression and display it as a null value on the page

There are two types of data binding in ASP. NET: Single-value binding and multi-value binding.


What they have in common: they do not need to work with ADO. NET at the same time.

Differences: Single-value binding can dynamically insert a variable, attribute, or expression into a page to help create a data control template.

Multi-value binding can display the content used by a table. It must support its special control (including the DataSource attribute)


Single value binding:

There are four common expressions:

<% = XX %>, inline mode, can reference C # code

<% # XXX %>, referencing the code field in the. cs File

<% # $ Xxx %>, referencing pre-defined fields or registered classes in the web. config file

<% # Eval (xxx) %>. You need to bind the data source.

All Rights Reserved: jory-able to withstand torture and loneliness

From jory

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.