using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace cj168.Web
{
/// <summary>
/// Summary description for showIssueCat.
/// </summary>
public class showIssueCat : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label lbMagInfo;
protected System.Web.UI.WebControls.DataList datalistMagCat;
protected System.Web.UI.WebControls.DataList datalistTest;
protected System.Web.UI.WebControls.LinkButton LinkButton;
int intMagID;
int intMagYear;
int intYearIssue;
public showIssueCat()
{
Page.Init += new System.EventHandler(Page_Init);
}
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
String strMagName = Request.Params["MagName"].ToString();
String strMagID = Request.Params["MagID"].ToString();
String strMagYear = Request.Params["MagYear"].ToString();
String strYearIssue = Request.Params["YearIssue"].ToString();
if (strMagName != String.Empty && strMagID != String.Empty && strMagYear != String.Empty && strYearIssue != String.Empty)
{
intMagID = Int32.Parse(strMagID);
intMagYear = Int32.Parse(strMagYear);
intYearIssue = Int32.Parse(strYearIssue);
lbMagInfo.Text = strMagName + " " + strMagYear + "年度 第" + strYearIssue + "期";
}
else
{
lbMagInfo.Text = "参数有错";
}
BindData(intMagID, intMagYear, intYearIssue);
}
void BindData(int MagID, int MagYear, int YearIssue)
{
cj168.DataAccess.MagsDB ShowMagIssueCat = new cj168.DataAccess.MagsDB();
datalistMagCat.DataSource = ShowMagIssueCat.GetMagIssueCat(MagID, MagYear, YearIssue);
datalistMagCat.DataBind();
}
public SqlDataReader GetThreadMessages()
{
// Obtain a list of discussion messages for the module
//ASPNetPortal.DiscussionDB discuss = new ASPNetPortal.DiscussionDB();
//SqlDataReader dr = discuss.GetThreadMessages(TopLevelList.DataKeys[TopLevelList.SelectedIndex].ToString());
cj168.DataAccess.MagsDB ShowMagIssueCat = new cj168.DataAccess.MagsDB();
SqlDataReader dr = ShowMagIssueCat.GetMagIssueCat(1, 2001, 1);
// Return the filtered DataView
return dr;
}
public void DataList_ItemCommand(object Sender, DataListCommandEventArgs e)
{
string cmd = ((LinkButton)e.CommandSource).CommandName;
if (cmd == "select")
datalistMagCat.SelectedIndex = e.Item.ItemIndex;
BindData(intMagID, intMagYear, intYearIssue);
}
public void DataList_CancelCommand(Object Sender, DataListCommandEventArgs e)
{
datalistMagCat.SelectedIndex = -1;
BindData(intMagID, intMagYear, intYearIssue);
}
private void Page_Init(object sender, EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
}
#region Web Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
part1: ShowIssueCat.aspx.cs
80酷酷网 80kuku.com