Asp+| Program Original author: Rain Morning
asp+ Forum List Program---code section
--------------------------------------------------------------------------------
"Bigeagle" was posted at Joy asp↑ in 2000-11-13 15:38:57:
///////////////////////////////////////////////////////////////////////////////
//
//File Name:forum.cs
//
//Description:forum.aspx Background code
//
//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; Transform Layout dropdown box
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");
// }
//-----------------------------------------------
//Receive forum ID
Try
{
Intforumid = request.querystring["ID"]. ToInt32 ();
}
catch (Exception exp)
{
Response.Write (exp. ToString ());
}
Getforuminfo (Intforumid);
//Receive page number
Try
{
Intpageno = request.querystring["PageNo"]. ToInt32 ();
}
catch (Exception exp)
{
Intpageno = 1;
}
//Spec page number, pages
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;
}
//Initialization page display
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;
//update navigation bar
//Home
if (Intpageno!= 1)
{
Linkfirstpage.navigateurl = "forum.aspx" + "id=" + intforumid.tostring ();
Linkfirstpage.tooltip = "Back to home page";
Linkfirstpage1.navigateurl = "forum.aspx" + "id=" + intforumid.tostring ();
Linkfirstpage1.tooltip = "Back to home page";
}
Else
{
Linkfirstpage.tooltip = "You are on the home page now." " ;
Linkfirstpage1.tooltip = "You are on the home page now." " ;
}
//Front page
if (Intpageno > 1)
{
Linkprevpage.navigateurl = "forum.aspx" + "id=" + intforumid.tostring ()
+ "&pageno=" + (intPageNo-1). ToString ();
Linkprevpage.tooltip = "Go back to the previous page." " ;
Linkprevpage1.navigateurl = "forum.aspx" + "id=" + intforumid.tostring ()
+ "&pageno=" + (intPageNo-1). ToString ();
Linkprevpage1.tooltip = "Go back to the previous page." " ;
}
Else
{
Linkprevpage.tooltip = "You are on the first page now, where do you want to go?" " ;
Linkprevpage1.tooltip = "You are on the first page now, where do you want to go?" " ;