. NET data control binding statement Summary

Source: Internet
Author: User

Recently, I felt that the data binding controls were messy. I wanted to tell you all about them, but I just wanted to open my mouth and found that I didn't have a complete concept in my mind, I will summarize it myself. I don't know it's all.

Here, there are four concepts: the container control that you want to bind data refers to the parent control, dataitem refers to the current row of the data source bound to the parent control, and eval and bind are not mentioned here.

Assume that there are two data sources: 1. A generic class list <student> or datatable

They all have a field ID.

1. <% # eval ("ID") %> (these are also three methods)

2. <% # (student) container. dataitem). Id %>

3. <% # (system. Data. datarowview) container. dataitem) ["ID"]. tostring () %>

4. <asp: Label id = "label1" runat = "server" text = '<% # (student) container. dataitem). Id %>'>

5. <asp: Label id = "label1" runat = "server" text = '<% # (system. data. datarowview) container. dataitem) ["ID"]. tostring () %> '>

6. <asp: Label id = "label1" runat = "server" text = '<% # databinder. eval (container, "dataitem. ID") %>'>

7. <asp: Label id = "label1" runat = "server" text = '<% # databinder. eval (container. dataitem, "ID") %>'>

8. <asp: Label id = "label1" runat = "server" text = '<% # eval ("ID") %>'> </ASP: Label>

Here I will not write the bind.

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: info-contact@alibabacloud.com 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.