实现论坛的大菜单套小菜但的功能------datalist套datalist

在这里由于类库太大了,所以只提供部分实现
1.default.aspx
<% @ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default"  %>

<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" >
< html  xmlns ="http://www.w3.org/1999/xhtml" >
< head  runat ="server" >
    
< title > Untitled Page </ title >
    
< link  href ="StyleSheet.css"  rel ="stylesheet"  type ="text/css"   />
</ head >
< body >
    
< form  id ="form1"  runat ="server" >
        
< asp:ScriptManager  ID ="ScriptManager1"  runat ="server"   />
          
< asp:DataList  ID ="dlMenuBig"  runat ="server"  Width ="850px"  OnItemDataBound ="dlMenuBig_ItemDataBound" >
                    
< ItemTemplate >
                        
< table  border ="1"  cellpadding ="0"  cellspacing ="0"  class ="bordercolor" >
                            
< tr >                                 
                                
< td  class ="td_c" >
                                    
< asp:Label  ID ="lblId"  runat ="server"  Text ='<%#Eval("MenuBig_Id")  % > ' Visible="false"> </ asp:Label >
                                    
< href ="SmallClassList.aspx?bigid=<%#Eval(" MenuBig_Id") % > ">
                                    
< font  > <% #Eval("MenuBig_Name" %> </ font ></ a > &nbsp;&nbsp; < img  alt ="http://www.yyzyq.com"  src ="images/team2.gif"   /> 区长: <% #Eval("MenuBig_Admin" %>
                                
</ td >
                            
</ tr >
                            
< tr >
                                
< td >
                                 
< asp:DataList  ID ="dlMenuSmall"  runat ="server"  BorderStyle ="None"  Width ="850px"  OnItemDataBound ="dlSmall_ItemDataBound" >
                                        
< ItemTemplate >
                                        
< table  border ="1"  class ="bordercolor"  cellpadding ="0"  cellspacing ="0" >                             
                                            
< tr >
                                                
< td >
                                                    
< table  border ="0"  cellpadding ="0"  cellspacing ="0"  style ="width: 850px" >
                                                        
< tr >
                                                            
< td  rowspan ="3"  style ="width: 40px" >
                                                                
< asp:Label  ID ="lblSmallId"  runat ="server"  Text ='<%#Eval("MenuSmall_Id")  % > ' Visible="false"> </ asp:Label >< img  id ="imgToday"  runat ="server"  alt ="http://www.yyzyq.com"  src ="images/day1.gif"  width ="40"   /></ td >
                                                            
< td  colspan ="2"  style ="width:360px" >
                                                                
< href ="PostList.aspx?smallid=<%#Eval(" MenuSmall_Id") % > "> <% #Eval("MenuSmall_Name" %> </ a ></ td >
                                                            
< td  style ="width:100px" >
                                                                今日:
< asp:Label  ID ="lblToday"  runat ="server"  Text ='<%#Eval("MenuSmall_ToDayPostCount")  % > '> </ asp:Label ></ td >
                                                            
< td  rowspan ="3"  style ="width: 70px"  align ="center" >
                                                                
< img  alt ="http://www.yyzyq.com"  src ="<%#Eval(" MenuSmall_ImgUrl") % > " width="60" />
                                                                    
</ td >
                                                            
< td  style ="width: 300px" >
                                                                标题:
< href ="BrowsePost.aspx?smallid=<%#Eval(" MenuSmall_Id") % > &postid = <% #Eval("Post_Id" %> "> <% #Eval("Post_Title" %> </ a ></ td >
                                                        
</ tr >
                                                        
< tr >
                                                            
< td  colspan ="2" >
                                                                
< img  alt ="http://www.51aspx.com"  src ="images/Forum_readme.gif"   />
                                                                
< img  alt ="http://www.51aspx.com"  src ="images/descripte.gif"   />< href ="PostList.aspx?smallid=<%#Eval(" MenuSmall_Id") % > "> <% #Eval("MenuSmall_Description" %> </ a ></ td >
                                                            
< td >
                                                                帖子:
<% #Eval("MenuSmall_PostCount" %> </ td >
                                                            
< td >
                                                                发帖:
< href ="BrowseUserInfo.aspx?id=<%#Eval(" User_Id") % > "> <% #Eval("User_Name" %> </ a >< img  src ="images/lastpost.gif"   /></ td >
                                                        
</ tr >
                                                        
< tr >
                                                            
< td >
                                                                
< img  alt ="http://www.51aspx.com"  src ="images/team2.gif"   /> 版主: <% #Eval("MenuSmall_Admin" %> </ td >
                                                            
< td  align ="right" >
                                                                
<!-- <asp:ImageButton ID="ibtnSendPost" runat="server" ImageUrl="~/images/ipost1.gif" CommandName="SendPost" /> --> &nbsp;&nbsp; </ td >
                                                            
< td >
                                                                回复:
<% #Eval("MenuSmall_PostBackCount" %> </ td >
                                                            
< td >
                                                                时间:
<% #Eval("Post_SendTime" %> </ td >
                                                        
</ tr >
                                                    
</ table >
                                                
</ td >
                                             
</ tr >
                                         
</ table >
                                        
</ ItemTemplate >
                                    
</ asp:DataList >
                                
</ td >
                            
</ tr >
                        
</ table >< br  />
                    
</ ItemTemplate >
                
</ asp:DataList >
        
< div >
            
< href ="Default.aspx" ></ a > &nbsp; </ div >
    
</ form >
</ body >
</ html >

2.
using  System;
using  System.Data;
using  System.Configuration;
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  WeYyzyq.Logic;
public   partial   class  _Default : System.Web.UI.Page 
{
    Bbs_MenuBig menubig 
= new Bbs_MenuBig();
    Bbs_MenuSmall menusmall 
= new Bbs_MenuSmall();
    
protected void Page_Load(object sender, EventArgs e)
    
{
        
        menubig.BindMenuBig(dlMenuBig);

    }

    
protected void dlMenuBig_ItemDataBound(object sender, DataListItemEventArgs e)
    
{   
        
if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
        
{
            menusmall.BindMenuSmallBig((DataList)e.Item.FindControl(
"dlMenuSmall"), ((Label)e.Item.FindControl("lblId")).Text);
        }

    }

 

}

3.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
>