<% @ Control Language = "C #" autoeventwireup = "true" codefile = "news. ascx. cs" inherits = "news" %>
<Asp: repeater id = "repeater1" runat = "server">
<Itemtemplate>
<Li>
· <A href = "<% # strurl (eval (" isoutlink "). tostring (), Eval ("pagepath "). tostring () %> "class =" def "rel =" external "> <% # getstrlength (eval (" title "). tostring (), 14) %> </a>
</LI>
</Itemtemplate>
</ASP: repeater>
<Asp: Label id = "lb_error" runat = "server" visible = "false"> </ASP: Label>
Private string _ dispnum = ""; // defines the number of display entries
Public String dispnum
{
Get
{
Return _ dispnum;
}
Set
{
_ Dispnum = value;
}
}
Private string _ classid = ""; // defines the news category ID
Public String classid
{
Get
{
Return _ classid;
}
Set
{
_ Classid = value;
}
}
Private int _ strlen = 1; // defines the display length.
Public int strlen
{
Get
{
Return _ strlen;
}
Set
{
_ Strlen = value;
}
}
Protected string getstrlength (string STR, int Len)
{
If (Str. Length <this. strlen)
Return STR;
STR = Str. substring (0, this. strlen );
Return STR;
}
Call:
<% @ Register src = "usercontrol/news. ascx" tagname = "news" tagprefix = "uc8" %>
<Uc8: News id = "news12" runat = "server" dispnum = "6" strlen = "25" classid = "zbgg"/>