会员
周边
众包
新闻
博问
闪存
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
随机博客
Random Blog
博客园
首页
联系
订阅
管理
多列分页算法
private
void
ShowRecord(
int
RecordCount,
int
CellCount,
int
CurrentPage)
{
int
CurrentRC,TotalCount,FinalCount,CurrentLocation;
string
ImageName,ImageUrl;
TableRow Tr
=
new
TableRow();
TableCell Tc
=
new
TableCell();
TotalCount
=
RecordInfo.GetRecordCount();
FinalCount
=
TotalCount
/
CellCount
+
1
;
TotalPage
=
(FinalCount
-
1
)
/
RecordCount
+
1
;
CurrentRC
=
FinalCount
-
(CurrentPage
-
1
)
*
RecordCount;
if
(CurrentRC
>
RecordCount) CurrentRC
=
RecordCount;
if
(CurrentPage
>
TotalPage) CurrentPage
=
1
;
for
(
int
i
=
(CurrentPage
-
1
)
*
RecordCount;i
<
CurrentRC
+
(CurrentPage
-
1
)
*
RecordCount;i
++
)
{
Tc.Controls.Add(
new
LiteralControl(
"
<table><tr>
"
));
for
(
int
j
=
1
;j
<=
CellCount;j
++
)
{
CurrentLocation
=
(CurrentPage
-
1
)
*
RecordCount
*
CellCount
+
(i
%
RecordCount)
*
CellCount
+
j;
if
(TotalCount
>=
CurrentLocation)
{
ImageName
=
RecordInfo.GetValue(CurrentLocation
-
1
,
1
);
ImageUrl
=
RecordInfo.GetValue(CurrentLocation
-
1
,
0
);
Tc.Controls.Add(
new
LiteralControl(
"
<td width='120' height='120'><a target='_blank' title='
"
+
ImageName
+
"
' href='
"
+
ImageUrl
+
"
'><img border='0' width='100' height='100' src='
"
+
ImageUrl
+
"
'></a></td>
"
));
}
else
j
=
CellCount
+
1
;
}
Tc.Controls.Add(
new
LiteralControl(
"
</tr></table>
"
));
Tr.Cells.Add(Tc);
pic.Rows.Add(Tr);
}
}
posted @
2006-10-08 15:21
随机
阅读(
281
) 评论(
0
)
编辑
收藏
举报
刷新页面
返回顶部
公告