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 ??