Use the datalist control to display news titles in two columns

Source: Internet
Author: User

Originally, the gridview was used to display the News Title List and link. Because the gridview does not display multiple columns, the datalist control is used for the first time to display the News Title List and link in two columns.
<Asp: datalist id = "dlsyxcf" runat = "server" performanceid = "odsnews" width = "476px" repeatcolumns = "2" repeatdirection = "horizontal">
<Itemtemplate>
<Table border = "0" cellpadding = "0" cellspacing = "0" style = "width: 238px">
<Tr>
<TD align = "Left" style = "width: pixel PX; Height: 14px" valign = "Middle">
<A href = shownewscontent. aspx? Id = <% # eval ("ID") %> Target = "_ blank"> <% # eval ("title") %> </a> </TD>
<TD align = "Left" style = "width: 48px; Height: 14px; color: Gray;" valign = "Middle">
<% # Eval ("timeissue", "{0: d}") %> </TD>
</Tr>
</Table>
</Itemtemplate>
</ASP: datalist>
To make the layout neat, the table is used in <itemtemplate> and the link is this statement:
<A href = shownewscontent. aspx? Id = <% # eval ("ID") %> Target = "_ blank"> <% # eval ("title") %> </a>
It feels too clumsy and there should be a better way.
Data Source Control: objectdatasource
<Asp: objectdatasource id = "odsnews" runat = "server" selectmethod = "getdstnewstitle"
Typename = "jobdatareader">
<Selectparameters>
<Asp: parameter defaultvalue = "1001001001001001001001001001003" name = "classid"/>
<Asp: parameter defaultvalue = "20" name = "showtop"/>
</Selectparameters>
</ASP: objectdatasource>

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.