Create a user control with a template V.2, template v.2

Source: Internet
Author: User

Create a user control with a template V.2, template v.2

The previous exercise "create a user control with template" http://www.cnblogs.com/insus/p/4161544.html. Too simplified. Usually, the Data Control Repeater has a webpage to write the Header, Item, AlternatingItem and Footer. To dynamically generate columns, We need to write a template in the background.

Review the Repeater controls dynamic change columns (Header, Item and Foot) Information http://www.cnblogs.com/insus/archive/2013/03/22/2974970.html. As the data changes, the name of the column changes, and only the dynamic implementation is required.

If a template does not have much impact, we can do it in the background.

 
Below we pull a Repeater control on the webpage:

 

After pulling the Repeater control, you must write headers, items, footer, and so on. Now there is no need to write anything for this pull, just like the GridView control. Because we have produced the content presented by the Repeater control in the background.


In this way, where are the bound content and fields written? It is written in the InsusTemplate custom template:

 


Running result:

 
OK. If you still want to obtain the Literal control value in xxx. aspx. cs, you can refer to the following method to obtain it. First, enable the OnItemDataBound feature in the Repeater control:

Repeaterincluitemdatabound event:

 

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: 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.