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

ASP.NET
GridView添加删除按钮终极办法
AjaxPro让.NET的AjaxPro变得简单
c# 实现Word联接Excel的MailMerge功能
解开Ajax技术中的达芬奇密码
专家讲解用.NET编写串口程序的一点心得
利用AJAX和ASP.NET实现简单聊天室
如何快速捕获.NET代码中隐藏的BUG
动态网页原理/.net面面观
从N层到.NET详细剖析原理(2)
从N层到.NET详细剖析原理(1)
ASP.NET效率陷阱之——Attributes
在ASP.NET 2.0中建立站点导航层次(5)
在ASP.NET 2.0中建立站点导航层次(4)
在ASP.NET 2.0中建立站点导航层次(3)
在ASP.NET 2.0中建立站点导航层次(2)
在ASP.NET 2.0中建立站点导航层次(1)
动态网站Web开发PHP、ASP还是ASP.NET(2)
动态网站Web开发PHP、ASP还是ASP.NET(1)
让Apache支持ASP.NET-Apache,ASP.NET
.Net下的数据备份和还原

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 41 ::
收藏到网摘: 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 = "你现在就位于第一页,你还想上哪儿?" ;