ASP. NET Repeater control nested Query

Source: Internet
Author: User

The function I want to implement is the first eight articles in all the topics under the first channel of reality. Article .
Html Code As follows:
<Asp: repeater id = "repchannel" runat = "server">
<Headertemplate>
<Div class = "leftlist">
</Headertemplate>
<Itemtemplate>
<Asp: repeater id = "repcategory" runat = "server" datasource = '<% # getcategoryarticle (eval ("ID"). tostring () %>'>
<Headertemplate>
<Div class = "blank20"> </div>
<Ul>
</Headertemplate>
<Itemtemplate>
<Li>
<H5> [<a href = 'showcategory. aspx? Categoryid = <% # databinder. eval (container. dataitem, "categoryid") %> '> <% # databinder. eval (container. dataitem, "categoryid") %> </a>] <a href = 'warticle. aspx? Categoryid = <% # databinder. eval (container. dataitem, "categoryid") %> & ArticleID = <% # databinder. eval (container. dataitem, "article. ID ") %> '> <% # databinder. eval (container. dataitem, "article. title ") %> </a> </H5>
<H6> <% # databinder. eval (container. dataitem, "pubdate") %> </H6>
</LI>
</Itemtemplate>
<Footertemplate> </ul> </footertemplate>
</ASP: repeater>
</Itemtemplate>
<Footertemplate>
</Div>
</Footertemplate>
</ASP: repeater>
The CS code is as follows:
Protected oledbdatareader getcategoryarticle (string CID)
{
String strconn = configurationmanager. connectionstrings ["jcbconnectionstring"]. connectionstring;
String strsql = "select Top 8 * From cclistview where categoryid =" + CID + "order by article. id desc ";
Oledbconnection objconn = new oledbconnection (strconn );
Oledbcommand objcmd = new oledbcommand (strsql, objconn );
Objconn. open ();
Return objcmd. executereader (commandbehavior. closeconnection );
}

The cclistview view is as follows:

Execution result:
Databinding: "system. Data. Common. dbdatarecord" does not contain the attribute "article.

Isn't that possible ??

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.