文章的上一篇和下一篇导航 V2(2)
<ItemTemplate>
<!--其它信息字段显示-->
上一篇:<asp:HyperLink ID="HyperLinkPrev" runat="server" Target="_blank"></asp:HyperLink>
<br />
下一篇:<asp:HyperLink ID="HyperLinkNext" runat="server" Target="_blank"></asp:HyperLink>
</ItemTemplate>
</asp:Repeater>
ArticleView.aspx.vb:
View Code
Protected Sub RepeaterArticleView_ItemDataBound(sender As Object, e As RepeaterItemEventArgs)
Dim drv As DataRowView = DirectCast(e.Item.DataItem, DataRowView)
If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItemType.AlternatingItem Then
If e.Item.FindControl("HyperLinkPrev") IsNot Nothing Then
Dim prevLink As HyperLink = DirectCast(e.Item.FindControl("HyperLinkPrev"), HyperLink)
If String.IsNullOrEmpty(drv("PrevArticleId").ToString()) Then
prevLink.Text = "无"
Else
prevLink.Text = drv("PrevSubject")
prevLink.NavigateUrl = "~/ArticleView.aspx?ID=" & drv("PrevArticleId")
End If
End If
If e.Item.FindControl("HyperLinkNext") IsNot Nothing Then
Dim nextLink As HyperLink = DirectCast(e.Item.FindControl("HyperLinkNext"), HyperLink)
If String.IsNullOrEmpty(drv("NextArticleId").ToString()) Then
nextLink.Text = "无"
相关新闻>>
- 发表评论
-
- 最新评论 更多>>