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;
}
}
查看全文
相关阅读:
单片机4*4按键数码管显示0-9
netbeans设置语言
单片机中断的应用
Linux 命令总结
vc6.0快捷键大全
怎么使PUTTY一直连接
mysql alter 效率
treeview
Gitbook
linux 进程监控软件 supervisor
原文地址:https://www.cnblogs.com/liuweitoo/p/906708.html
最新文章
解决Android Graphical Layout 界面效果不显示
有关stm32的问题,程序里面的u8、u16这些是什么意思啊
#ifndef _LED_H #endif啥意思?
Flash Download Failed-"Cortex-M3"
stm32 加入 USE_STDPERIPH_DRIVER、STM32F10X_HD的原因
KEIL MDK STM32如何建立工程
macbook使用“终端”远程登录linux主机
Qt5.5.0使用mysql编写小软件源码讲解---顾客信息登记表
linux centos6.5 ftp网页vsftpd配置
QT5.5.0版本添加icon图标步骤
热门文章
ZIP打包解包
启动mysql错误ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)
配置nginx好了,html能打开,index.php打不开?
discuz mysqli_connect() 不支持 advice_mysqli_connect
CentOS6.5搭建LNMP
单片机温度控制系统DS18B20
留念 C语言第一课简单的计算器制作
netbeans打包成jar
java运算优先级
JAVA构造方法与方法是啥意思,方法重载方法覆盖俗谈
Copyright © 2011-2022 走看看