当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > asp+的论坛列表程序---代码部分

ASP.NET
AspNetPager与Socut.Data使用方法
asp.net UpdaeProgress的简单用法
asp.net ajaxControlToolkit ValidatorCalloutExtender的简单用法
asp.net 简易生成注册码(数字+大小写字母)
asp.net中利用ashx实现图片防盗链代码
ASP.NET程序中常用代码汇总
ASP.NET 2.0/3.5中直接操作Gridview控件插入新记录
ASP.NET Ajax级联DropDownList实现代码
ASP.NET 2.0写无限级下拉菜单
asp.net Web Services上传和下载文件(完整代码)
asp.net DataGrid控件中弹出详细信息窗口
Asp.NET 多层登陆实现代码
利用Asp.Net回调机制实现进度条
ASP.NET Ref和Out关键字区别分析
Javascript调用Webservice的多种方法
.Net下的签名与混淆图文分析
.Net Compact Framework开发小技巧 推荐
.Net连接Oracle数据库的实现代码
js获取.aspx页面里面的服务器控件和.ascx中的服务器控件值
asp.net下 jquery jason 高效传输数据

ASP.NET 中的 asp+的论坛列表程序---代码部分


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 43 ::
收藏到网摘: n/a

asp+的论坛列表程序---代码部分

--------------------------------------------------------------------------------
【bigeagle】 于 2000-11-13 15:38:57 加贴在 Joy ASP ↑:

///////////////////////////////////////////////////////////////////////////////
//
// File name: forum.cs
//
// Description: forum.aspx的后台代码
//
// date: 2000/10/13
//
// Programming: Bigeagle
//
// History: version 1.0
// start at 2000/10/13 16:45 finish
//
////////////////////////////////////////////////////////////////////////////////

using System;
using System.Collections ;
using System.Data;
using System.Data.SQL;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Drawing ;

public class Forum : Page
{

//public Image imgIfNew ;
public Label lblForumName ;
public HyperLink linkMaster ;
public Label lblForumName1 ;
public ImageButton btnPostNew ;
public ImageButton btnPostNew1 ;
public Label lblTopicCounts ;
public Label lblTopicCounts1 ;
public Label lblPerPage ;
public Label lblPosition ;
public HtmlImage imgOICQ ;
public HyperLink linkFirstPage ;
public HyperLink linkPrevPage ;
public HyperLink linkNextPage ;
public HyperLink linkLastPage ;
public HyperLink linkFirstPage1 ;
public HyperLink linkPrevPage1 ;
public HyperLink linkNextPage1 ;
public HyperLink linkLastPage1 ;
public DropDownList selChangeForum ; //转换版面下拉框

public Table tblTopic ;

public void Page_Load(Object sender , EventArgs e)
{
Int32 intForumID = new Int32();
Int32 intPageNo = new Int32() ;
int intPageSize = 20 ;
int intPageCount = 0 ;
int intTopicCounts = 0 ;


//--edit by bigeagle 2000/10/25------------------
// if (Session["LoginID"] == null )
// {
// Response.Redirect("login.aspx") ;
// }
//-----------------------------------------------

//接收论坛ID
try
{
intForumID = Request.QueryString["ID"].ToInt32() ;

}
catch(Exception exp)
{
Response.Write(exp.ToString()) ;
}

GetForumInfo(intForumID) ;

//接收页号
try
{
intPageNo = Request.QueryString["PageNo"].ToInt32() ;

}
catch(Exception exp)
{
intPageNo = 1 ;
}

//规范页号,页数
intTopicCounts = lblTopicCounts1.Text.ToInt32() ;
if (intTopicCounts <= intPageSize)
{
intPageCount = 1 ;
}
else if (intTopicCounts / intPageSize == 0)
{
intPageCount = intTopicCounts / intPageSize ;
}
else
{
intPageCount = (int)(intTopicCounts / intPageSize) + 1 ;
}

if (intPageNo < 1)
{
intPageNo = 1 ;
}
else if (intPageNo > intPageCount)
{
intPageNo = intPageCount ;
}

//初始化页面显示
lblTopicCounts.Text = intTopicCounts.ToString() ;
lblTopicCounts.ForeColor = Color.Green ;
lblPerPage.Text = intPageSize.ToString() ;
lblPerPage.ForeColor = Color.Green ;
lblPosition.Text = intPageNo.ToString() + "/" + intPageCount.ToString() ;
lblPosition.ForeColor = Color.Green ;


//更新导航栏

//首页
if (intPageNo != 1)
{
linkFirstPage.NavigateUrl = "forum.aspx?" + "ID=" + intForumID.ToString() ;
linkFirstPage.ToolTip = "回到首页" ;
linkFirstPage1.NavigateUrl = "forum.aspx?" + "ID=" + intForumID.ToString() ;
linkFirstPage1.ToolTip = "回到首页" ;
}
else
{
linkFirstPage.ToolTip = "你现在就在首页。" ;
linkFirstPage1.ToolTip = "你现在就在首页。" ;
}

//前页
if (intPageNo > 1 )
{
linkPrevPage.NavigateUrl = "forum.aspx?" + "ID=" + intForumID.ToString()
+ "&PageNo=" + (intPageNo - 1).ToString() ;
linkPrevPage.ToolTip = "回到。" ;
linkPrevPage1.NavigateUrl = "forum.aspx?" + "ID=" + intForumID.ToString()
+ "&PageNo=" + (intPageNo - 1).ToString() ;
linkPrevPage1.ToolTip = "回到。" ;
}
else
{
linkPrevPage.ToolTip = "你现在就位于第一页,你还想上哪儿?" ;
linkPrevPage1.ToolTip = "你现在就位于第一页,你还想上哪儿?" ;