zoukankan
html css js c++ java
Reapter嵌套
<
div
class
=
"
content
"
>
<
asp:Repeater ID
=
"
RepNewsClass
"
OnItemDataBound
=
"
RepNewsClass_ItemDataBound
"
runat
=
"
server
"
EnableViewState
=
"
false
"
>
<
ItemTemplate
>
<
div
class
=
"
class
"
>
<
div
class
=
"
classhead
"
>
<
div
class
=
"
classtitle
"
>
<%
# Eval(
"
ClassName
"
)
%>
</
div
>
<
div
class
=
"
more
"
>
<
a href
=
"
/news/catalog/<%# Eval(
"
ClassID
"
)%>.htm
"
><
img src
=
"
/images/more.gif
"
border
=
"
0
"
/></
a
>
</
div
>
</
div
>
<
div
class
=
"
classbody
"
>
<
div
class
=
"
picnews
"
>
<
asp:Literal ID
=
"
lt_PicNews
"
runat
=
"
server
"
EnableViewState
=
"
false
"
></
asp:Literal
>
</
div
>
<
asp:Repeater ID
=
"
RepNews
"
runat
=
"
server
"
EnableViewState
=
"
false
"
>
<
HeaderTemplate
>
<
ul
>
</
HeaderTemplate
>
<
ItemTemplate
>
<
li
>
<
a href
=
"
/news/<%# Eval(
"
NewsID
"
) %>.htm
"
title
=
"
<%# Eval(
"
Title
"
) %>
"
target
=
"
_blank
"
><%
# GkSystem.Utility.MyString.SubString(Eval(
"
Title
"
).ToString(),
40
,
""
)
%></
a
>
</
li
>
</
ItemTemplate
>
<
FooterTemplate
>
</
ul
>
</
FooterTemplate
>
</
asp:Repeater
>
</
div
>
</
div
>
<
div
class
=
"
clear
"
></
div
>
</
ItemTemplate
>
</
asp:Repeater
>
</
div
>
using
System;
using
System.Data;
using
System.Configuration;
using
System.Collections;
using
System.Web;
using
System.Web.Security;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Web.UI.WebControls.WebParts;
using
System.Web.UI.HtmlControls;
using
System.Data.SqlClient;
public
partial
class
News_Default : BasePage
{
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(
!
IsPostBack)
{
metakeywords.Content
=
GkSystem.BLL.SiteConfig.GetConfig().SiteKeyWords;
metadescription.Content
=
GkSystem.BLL.SiteConfig.GetConfig().SiteDescription;
this
.RepBrand.DataSource
=
GkSystem.BLL.Brands.GetListWhereBrandIDInNews();
this
.RepBrand.DataBind();
this
.RepRecommend.DataSource
=
new
GkSystem.BLL.News().GetList(
"
IsRecommend=1 AND ISDELETE=0 AND ISAUTH=1
"
);
this
.RepRecommend.DataBind();
DataSet ds
=
GkSystem.BLL.NewsClass.GetListWhereClassIDInNews();
this
.RepClass.DataSource
=
ds;
this
.RepClass.DataBind();
this
.RepNewsClass.DataSource
=
ds;
this
.RepNewsClass.DataBind();
this
.RepTop.DataSource
=
new
GkSystem.BLL.News().GetTopNews(
"
ISDELETE=0 AND ISAUTH=1
"
,
10
);
this
.RepTop.DataBind();
this
.RepNew.DataSource
=
new
GkSystem.BLL.News().GetNewNews(
"
ISDELETE=0 AND ISAUTH=1
"
,
10
);
this
.RepNew.DataBind();
}
}
protected
void
RepNewsClass_ItemDataBound(
object
sender, RepeaterItemEventArgs e)
{
if
(e.Item.ItemType
==
ListItemType.Item
||
e.Item.ItemType
==
ListItemType.AlternatingItem)
{
Repeater rep
=
(Repeater)e.Item.FindControl(
"
RepNews
"
);
int
ClassID
=
(
int
)((DataRowView)e.Item.DataItem)[
"
ClassID
"
];
rep.DataSource
=
new
GkSystem.BLL.News().GetTopNews(
"
ClassID=
"
+
ClassID
+
"
and ISDELETE=0 AND ISAUTH=1
"
,
6
);
rep.DataBind();
Literal lt_PicNews
=
(Literal)e.Item.FindControl(
"
lt_PicNews
"
);
lt_PicNews.Text
=
GetPicNews(ClassID);
}
}
protected
string
GetPicNews(
int
ClassID)
{
string
tmp
=
""
;
using
(SqlDataReader dr
=
GkSystem.DBUtility.SqlHelper.ExecuteReader(GkSystem.DBUtility.SqlHelper.ConnectionString,CommandType.Text,
"
select top 1 * from gk_sys_news where IsPicNews = 1 and Classid =
"
+
ClassID.ToString()))
{
if
(dr.Read())
{
tmp
+=
"
<div class=\
"
pic\
"
><a target='_blank' href='/news/
"
+
dr[
"
NewsID
"
].ToString()
+
"
.htm' title='
"
+
dr[
"
title
"
].ToString()
+
"
'><img src=\
""
;
if
(String.IsNullOrEmpty(dr[
"
TitlePic
"
].ToString()))
tmp
+=
"
/images/no-pic.gif\
""
;
else
tmp
+=
dr[
"
TitlePic
"
].ToString()
+
"
\
""
;
tmp
+=
"
/></a></div><div><a target='_blank' href='/news/
"
+
dr[
"
NewsID
"
].ToString()
+
"
.htm' title='
"
+
dr[
"
title
"
].ToString()
+
"
'>
"
+
GkSystem.Utility.MyString.SubString(dr[
"
Title
"
].ToString(),
16
,
""
)
+
"
</a></div>
"
;
}
else
{
tmp
=
"
<div class=\
"
pic\
"
><img src='/images/no-pic.gif' /></div><div></div>
"
;
}
}
return
tmp;
}
}
查看全文
相关阅读:
软件产品案例分析(团队)
Beta 冲刺 (2/7)
Beta 冲刺 (1/7)
机器学习笔记
第一次作业
机器学习第一个次个人作业
软工实践个人总结
第10组 Beta版本演示
第10组 Beta冲刺(5/5)
第10组 Beta冲刺(4/5)
原文地址:https://www.cnblogs.com/liuweitoo/p/906708.html
最新文章
Beta版本冲刺第三天
Beta版本冲刺第二天
Beta版本冲刺第一天
win10网络受限
HBuilder X 内置浏览器出现Failed to load URL 解决方案
.Net MVC在加载字体文件,比如woff2时报404,在当前项目下Web.config做如下操作即可
.net 字符串前面加@
网页查看cookie
.net vs 添加引用项目时候 出现黄色感叹号图标
Net 修改命名空间后 提示:未能找到类型或命名空间名称"" 解决方法
热门文章
解决IIS HTTP 错误 404.0
在腾讯云服务器centos7.5系统中lamp(centos7.5+apache+mysql+php)环境中安装ssl证书
解决在腾讯云服务器centos7.5系统中安装lamp(centos7.5+apache+mysql+php)中缺少mysqli模块的问题
个人作业——软件工程实践总结作业
Beta 答辩总结
Beta 冲刺 (7/7)
Beta 冲刺 (6/7)
Beta 冲刺 (5/7)
Beta 冲刺 (4/7)
Beta 冲刺 (3/7)
Copyright © 2011-2022 走看看