如果又有图片、又有文本,可能还有HTML标签,最好是手工控制分页。 即在内容插入特殊字符作为分段标记,如"^" 我发一段vb.net的方法给你,自己研究吧! Protected Sub GetNews(ByVal strNews As String, ByVal page As Integer) Dim temp As String() = strNews.Split("^"c) '取的分页符 If temp.Length <= 1 Then '文章内容 a_text.Text = strNews Else ' a_count.Text = "共" & temp.Length & "页 " For i As Integer = 0 To temp.Length - 1 Dim p1 As String If Request("page") = i Then p1 = p1 & "<div class=pages><a style=color:red;>" & (i + 1) & "</a></div>" Else p1 = p1 & (("<div class=pages><a href =n" & Request("id").ToString() & "_") & i & ".html>") & (i + 1) & "</a></div>" End If a_page.Text = p1 Next a_text.Text = temp(page).ToString() End If End Sub
即在内容插入特殊字符作为分段标记,如"^"
我发一段vb.net的方法给你,自己研究吧! Protected Sub GetNews(ByVal strNews As String, ByVal page As Integer) Dim temp As String() = strNews.Split("^"c)
'取的分页符
If temp.Length <= 1 Then
'文章内容
a_text.Text = strNews
Else
' a_count.Text = "共" & temp.Length & "页 "
For i As Integer = 0 To temp.Length - 1 Dim p1 As String
If Request("page") = i Then
p1 = p1 & "<div class=pages><a style=color:red;>" & (i + 1) & "</a></div>"
Else
p1 = p1 & (("<div class=pages><a href =n" & Request("id").ToString() & "_") & i & ".html>") & (i + 1) & "</a></div>"
End If
a_page.Text = p1 Next a_text.Text = temp(page).ToString() End If
End Sub
源代码,正在使用中,载入真接调用ContentPagination(内容变量)即可