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;
}
}
查看全文
相关阅读:
分布式事务的四种解决方案
uber-go/guide 的中文翻译
域名解析-CNAME
Nginx节点存活状态检查
Laravel核心解读--中间件(Middleware)
Mac dyld: Library not loaded: /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib
前缀树算法实现路由匹配原理解析
原创-实用salt部署文档(持续更新)
线上案例-调参-设置滑动窗口提高视频云播放性能
NGINX日志割切
原文地址:https://www.cnblogs.com/liuweitoo/p/906708.html
最新文章
linux系统/proc/cpuinfo文件与lscpu命令
Tomcat配置多个路由,负载均衡,及实现反代(http和nigix反代)
MYsql主从复制
JavaScript初学者
LAMP+NFS+Nginx+varnish+Haproxy+keepalived服务搭建
Hadoop HA架构搭建
hadoop+spark集群搭建
ES ik中文分词器的安装
lesson-1 HTML
lesson-4 颜色模式
热门文章
lesson-2 PhotoShop基本操作
lesson-1 图像处理基础
Go语言标准库log介绍
golang 几种字符串的连接方式
数据结构学习笔记----队列
gin学习笔记--session中间件
一篇文章为你图解Kubernetes网络通信原
Golang的spf13/pflag入门示例
[golang]text/template模板
redis 高并发分布式锁实现
Copyright © 2011-2022 走看看