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;
}
}
查看全文
相关阅读:
MyISAM和InnoDB的区别
MySQL——索引与优化
jquery选择器及效率问题
Mac 可设置环境变量的位置、查看和添加PATH环境变量
javascript默认中文(汉字/标点)长度均为1的解决
苹果下抓屏截屏方法 包括全屏、选择区域、窗口抓屏等
java实现window phone推送通知
设计模式总结
NHibernate 帮助类(单例实际运用)
访问者模式
原文地址:https://www.cnblogs.com/liuweitoo/p/906708.html
最新文章
【adb真机查Log】Android Studio 3.X 找不到Android Device Monitor
TypeScript快速笔记(二)
TypeScript快速笔记(一)
【初识TypeScript】 配置环境后运行Hello World编译报错.
[转]玩转Google开源C++单元测试框架Google Test系列(gtest)(总)
Unity-DLL反编译学习
Unity3D中使用Profiler精确定位性能热点的优化技巧
(转)Unity3d的3种截图方法
Unity系统自带函数生命周期以及相互关系
unity 播放外部视频
热门文章
NGUI Button 3中点击事件的触发
在unity中用鼠标实现在场景中拖动物体,用鼠标滚轮实现缩放
摇摆直升飞机 第一天
U3d 手游优化概述
Server.MapPath(string sFilePath) 报未将对象引用到实例异常
在unity 脚本中获取客户端的IP地址
2014 我的计划--向大牛出发
Java虚拟机学习
Mysql性能优化之缓存参数优化
shell if判断(曾经被一个字符串相等的判断纠结半小时,最后只是if后少了个空格!) 和 awk引用外部变量判断
Copyright © 2011-2022 走看看