您的位置:首页 > 运维架构 > 网站架构

企业网站权限设计实现:下载(前台示例)

2009-04-23 10:55 267 查看
企业网站权限设计实现的说明、界面、后台代码请见我的博客前几篇文章。没有后台数据,下面的示例是不能显示的。

下面的链接是一个企业网站示例,分后台数据库中读取数据。

功能有:

1、首页

2、栏目全部内容显示

3、正文显示

4、搜索

该示例尽量减少用户开发工作量,请看完代码后注意以下修改要点:

1、与后台修改类似,在web.config中修改数据库连接。

2、增加显示的栏目:参照已有栏目增加以下代码,并修改相关ID。

<div class="midhead">
2 <asp:Label ID="Lab_M2" runat="server" Text="栏目" CssClass="midheadname"></asp:Label>
3 <asp:HyperLink ID="Hlink_M2" runat="server" CssClass="midheadlink">更多 </div>
5 <div class="midcol">
6 <asp:Repeater ID="RPT_2" runat="server" DataSourceID="SDS_2" OnItemDataBound="RPT_Format">
7 <ItemTemplate>
8 <li class="uitype">
9 <asp:HyperLink ID="hlinktopic" runat="server" NavigateUrl='<%# Eval("infoid", "InfoDetail.aspx?infoid={0}")%>'
10 Text='<%#DataBinder.Eval(Container.DataItem, "infotopic").ToString() %>' title='<%# DataBinder.Eval(Container.DataItem, "infotopic") %>'>
11 </asp:HyperLink>
12 <asp:Label ID="labintime" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "infointime")%> '>
13 </asp:Label>
14 <br />
15 </li>
16 </ItemTemplate>
17 </asp:Repeater>
18 <asp:SqlDataSource ID="SDS_2" runat="server" ConnectionString="<%$ ConnectionStrings:connStr %>"
19 SelectCommand="Info_ShowByModuleID" SelectCommandType="StoredProcedure" DataSourceMode="DataReader">
20 <SelectParameters>
21 <asp:Parameter Name="Topn" Type="Int32" DefaultValue="15" />
22 <asp:ControlParameter ControlID="Lab_MID2" DefaultValue="" Name="ModuleID" PropertyName="Text"
23 Type="Int32" />
24 <asp:ControlParameter ControlID="Lab_Now" Name="InfoOutOfDate" PropertyName="Text"
25 Type="DateTime" />
26 </SelectParameters>
27 </asp:SqlDataSource>
28 <asp:Label ID="Lab_MID2" runat="server" Text="22" Visible="False"></asp:Label>
29 </div>
21行中的defaultvalue="15",指显示15条最新数据,根据需要修改;

28行中的text="22",指读取栏目ID为22的数据,根据需要修改;

相应修改default.aspx.cs的内容,参照其中的代码。

其它内容您就个性化定制吧。

前台示例下载
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐