温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:PersonalBlog源码
当前文件:
CommunityServerPersonalBlog/AppCode/Controls/Common/CurrentPage.cs[1K,2009-6-12 11:37:08],打开代码结构图
CommunityServerPersonalBlog/AppCode/Controls/Common/CurrentPage.cs[1K,2009-6-12 11:37:08],打开代码结构图1using System; 2
using System.Web.UI; 3
using System.Web.UI.WebControls; 4
using System.Web.UI.HtmlControls; 5
6
namespace NetFocus.Web.Applications.PersonalBlog 7
{ 8
public class CurrentPage : Label 9
{ 10
protected override void Render(HtmlTextWriter writer) { 11
12
Control skin = (Control) this.Parent; 13
Panel displayPager = (Panel) skin.FindControl("DisplayPager"); 14
15
// Do we have data? 16
// 17
if (TotalPages <= 1) 18
return; 19
20
if (displayPager != null) 21
displayPager.Visible = true; 22
23
this.Text = String.Format(TextFormat, PageIndex, TotalPages.ToString("n0"), TotalRecords.ToString("n0") ); 24
25
base.Render(writer); 26
27
} 28
29
public string TextFormat { 30
get { 31
Object state = ViewState[ "TextFormat" ]; 32
if ( state != null ) { 33
return (String)state; 34
} 35
return Resources.GetString("Utility_CurrentPage_text"); 36
} 37
set { 38
ViewState[ "TextFormat" ] = value; 39
} 40
} 41
42
public int PageIndex { 43
get { 44
int pageIndex = Convert.ToInt32(ViewState["PageIndex"]); 45
46
if (pageIndex == 0) 47
return 1; 48
49
return pageIndex; 50
} 51
set { 52
ViewState["PageIndex"] = value + 1; 53
} 54
} 55
56
public int TotalPages { 57
get { 58
int totalPages = Convert.ToInt32(ViewState["TotalPages"]); 59
60
if (totalPages == 0) 61
return 1; 62
63
return totalPages; 64
} 65
set { 66
ViewState["TotalPages"] = value; 67
} 68
} 69
70
public int TotalRecords { 71
get { 72
return Convert.ToInt32(ViewState["TotalRecords"]); 73
} 74
set { 75
ViewState["TotalRecords"] = value; 76
} 77
} 78
79
} 80
} 81






}
}