Creating a Web server control template with asp.net syntax

Source: Internet
Author: User

In the. aspx file, insert the element into the control to identify the template you are creating:



In the template element, add HTML text and other controls as the contents of the template. Includes properties and data-bound values for embedded controls that use general syntax:


Name: text= "<%# Container.DataListItem.Name%>"/>

Repeat steps 1 and 2 for each template that you want to create.

The following example shows a full declaration of the DataList Web server control with a simple template declared for the Header, Item, and Separator templates.


Items matching your query:


Name: Text= ' <%# DataBinder.Eval (Container, "Dataitem.employeename")
%> ' >





Note If the Web Forms designer does not render a Web server control correctly, it displays a gray box showing the text "Error creating the control." This usually means that the control's ASP.net syntax is incorrect-for example, if the runat= "server" attribute is missing from a Web server control element, this error is displayed. Point to the information icon (), and a tooltip appears that contains detailed information about the error.

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.