part1: ShowIssueCat.aspx.cs
2024-05-04 11:06:27
供稿:网友
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
}
}