". NET" Repeater controls simple data binding (with bool, date, ordinal)

Source: Internet
Author: User

mentioned above:

Speaking of repeater, the use of XML file read, not ADO, and paging there are many ways, such as with the PagedDataSource, or through the parameters of the data source write SQL statements to achieve.

Page:

<%@ Import Namespace="System.Data" %><Scriptrunat= "Server">protectedvoidPage_Load (Object O,eventargs e) {DataSet DS= NewDataSet (); Ds. READXML (HttpContext.Current.Server.MapPath ("\\XMLFile1.xml")); Rep1. DataSource=ds; Rep1.    DataBind (); }</Script><HTML><Body>        <Asp:repeaterID= "Rep1"runat= "Server">            <ItemTemplate>               <P>                    <%#Container. ItemIndex+1 %>|<%#Eval("name") %>|<%#Eval("Job Title") %> | <%# (Convert.toboolean (Eval("Incumbency Status"))==true)? "Serving" : "Not in service" %> | <%#Convert. ToDateTime (Eval("Date of entry")). ToString ("YYYY-MM-DD") %>               </P>            </ItemTemplate>        </Asp:repeater></Body></HTML>

XML file: (Xmlfile1.xml)

<?XML version= "1.0" encoding= "Utf-8"?><Department>  <Employees>    <name>Chen Xiao</name>    <Job Title>Supervisor</Job Title>    <Incumbency Status>True</Incumbency Status>    </Employees>  <Employees>    <name>Chen Xiaoxan</name>    <Job Title>Secretary</Job Title>    <Incumbency Status>True</Incumbency Status>  </Employees>  <Employees>    <name>Chen</name>    <Job Title>Assistant</Job Title>    <Incumbency Status>True</Incumbency Status>  </Employees>  <Employees>    <name>Chen Xiao</name>    <Job Title>Clerk</Job Title>    <Incumbency Status>True</Incumbency Status>  </Employees>  <Employees>    <name>Chen Xiaoliu</name>    <Job Title>Clerk</Job Title>    <Incumbency Status>True</Incumbency Status>  </Employees>  <Employees>    <name>Chen Xiaoxi</name>    <Job Title>Clerk</Job Title>    <Incumbency Status>False</Incumbency Status>  </Employees></Department>

". NET" Repeater controls simple data binding (with bool, date, ordinal)

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.