高手们下面是我的代码,帮我看看把,很着急,弄好了马上给分using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
namespace WelcomeSystem
{
/// <summary>
/// searchTotal 的摘要说明。
/// </summary>
public class searchTotal : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Panel Panel1;
protected System.Web.UI.WebControls.Button Button2;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.DropDownList xlmc;
protected System.Web.UI.WebControls.DropDownList djtd;
protected System.Web.UI.WebControls.DropDownList djdq;
protected System.Web.UI.WebControls.TextBox unpaied_time;
protected System.Web.UI.WebControls.TextBox st_time;
protected System.Web.UI.WebControls.TextBox course_code;
protected System.Web.UI.WebControls.Panel Panel2;
protected System.Web.UI.WebControls.DataGrid DataGrid1;
protected Wuqi.Webdiyer.AspNetPager AspNetPager2;
protected Wuqi.Webdiyer.AspNetPager AspNetPager1;
protected System.Web.UI.WebControls.DropDownList tdly;
private void Page_Load(object sender, System.EventArgs e)
{
if(!this.IsPostBack)
{
this.BindToPage();
}
// 在此处放置用户代码以初始化页面
}
private void BindToPage()
{
this.djdq.Attributes.Add("onChange","proform()");
SqlConnection con = DB.createCon();
con.Open();
SqlCommand cmd = new SqlCommand("select * from setsystem where Sort=2 order by place",con);
SqlDataReader sdr = cmd.ExecuteReader();
this.tdly.DataSource=sdr; this.tdly.DataTextField="setname";
this.tdly.DataValueField="ID";
this.tdly.DataBind();
this.tdly.Items.Insert(0,new ListItem("部门选择",""));
sdr.Close();
cmd.CommandText="select * from setsystem where Sort=1 order by place";
SqlDataReader sdr1 = cmd.ExecuteReader();
this.djdq.DataSource=sdr1; this.djdq.DataTextField="setname";
this.djdq.DataValueField="ID";
this.djdq.DataBind();
this.djdq.Items.Insert(0,new ListItem("地接地区",""));
this.djtd.Items.Insert(0,new ListItem("地接团队",""));
sdr1.Close(); cmd.CommandText="select * from line order by adddate desc";
SqlDataReader sdr2 = cmd.ExecuteReader();
this.xlmc.DataSource=sdr2;
this.xlmc.DataTextField="linename";
this.xlmc.DataValueField="ID";
this.xlmc.DataBind();
this.xlmc.Items.Insert(0,new ListItem("线路名称",""));
sdr2.Close();
} #region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load); }
#endregion private void Button1_Click(object sender, System.EventArgs e)
{
SqlConnection con = DB.createCon();
con.Open(); string StrSql="select count(upteam.ID) from upteam,team,line where team.ID=upteam.djtd and line.ID=upteam.xlmc ";
if(this.tdly.SelectedItem!=null && this.tdly.SelectedValue.ToString()!="")
{
StrSql=StrSql+" and upteam.tdly='"+this.tdly.SelectedValue.ToString()+"'";
}
if(this.course_code.Text!=null && this.course_code.Text.ToString()!="")
{
StrSql=StrSql+" and upteam.course_code='"+this.course_code.Text.ToString()+"'";
}
if(this.djdq.SelectedItem!=null && this.djdq.SelectedValue.ToString()!="")
{
StrSql=StrSql+" and upteam.djdq='"+this.djdq.SelectedValue.ToString()+"'";
}
// if(Request["djtd"].ToString()!="")
// {
// StrSql=StrSql+" and upteam.djtd='"+Request.Form["djtd"].ToString()+"'";
// }
if(this.xlmc.SelectedItem!=null && this.xlmc.SelectedValue.ToString()!="")
{
StrSql=StrSql+" and upteam.xlmc='"+this.xlmc.SelectedValue.ToString()+"'";
} SqlCommand cmd = new SqlCommand(StrSql,con);
this.AspNetPager1.RecordCount=(int)cmd.ExecuteScalar();
this.BindToDataGrid();
}
private void BindToDataGrid()
{
this.Panel1.Visible=false;
this.Panel2.Visible=true;
this.DataGrid1.Visible=true;
this.AspNetPager1.Visible=true;
SqlConnection con = DB.createCon();
SqlDataAdapter sda = new SqlDataAdapter();
string StrSql="select team.teamname,line.linename,upteam.ID,upteam.course_code,upteam.crs,upteam.ets,upteam.pts from upteam,team,line where team.ID=upteam.djtd and line.ID=upteam.xlmc ";
if(this.tdly.SelectedItem!=null && this.tdly.SelectedValue.ToString()!="")
{
StrSql=StrSql+" and upteam.tdly='"+this.tdly.SelectedValue.ToString()+"'";
}
if(this.course_code.Text!=null && this.course_code.Text.ToString()!="")
{
StrSql=StrSql+" and upteam.course_code='"+this.course_code.Text.ToString()+"'";
}
if(this.djdq.SelectedItem!=null && this.djdq.SelectedValue.ToString()!="")
{
StrSql=StrSql+" and upteam.djdq='"+this.djdq.SelectedValue.ToString()+"'";
}
// if(Request["djtd"].ToString()!="")
// {
// StrSql=StrSql+" and upteam.djtd='"+Request.Form["djtd"].ToString()+"'";
// }
if(this.xlmc.SelectedItem!=null && this.xlmc.SelectedValue.ToString()!="")
{
StrSql=StrSql+" and upteam.xlmc='"+this.xlmc.SelectedValue.ToString()+"'";
} StrSql=StrSql+" order by upteam.st_time desc,upteam.tdly";
// Response.Write(StrSql);
// Response.End();
sda.SelectCommand=new SqlCommand(StrSql,con);
DataSet ds = new DataSet(); sda.Fill(ds,this.AspNetPager1.PageSize*(this.AspNetPager1.CurrentPageIndex-1),this.AspNetPager1.PageSize,"upteam"); this.DataGrid1.DataKeyField="ID";
this.DataGrid1.DataSource=ds.Tables["upteam"];
this.DataGrid1.DataBind();
} private void AspNetPager1_PageChanged(object sender, Wuqi.Webdiyer.PageChangingEventArgs e)
{
this.AspNetPager1.CurrentPageIndex = e.NewPageIndex;
this.BindToDataGrid();
} }
}
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
namespace WelcomeSystem
{
/// <summary>
/// searchTotal 的摘要说明。
/// </summary>
public class searchTotal : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Panel Panel1;
protected System.Web.UI.WebControls.Button Button2;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.DropDownList xlmc;
protected System.Web.UI.WebControls.DropDownList djtd;
protected System.Web.UI.WebControls.DropDownList djdq;
protected System.Web.UI.WebControls.TextBox unpaied_time;
protected System.Web.UI.WebControls.TextBox st_time;
protected System.Web.UI.WebControls.TextBox course_code;
protected System.Web.UI.WebControls.Panel Panel2;
protected System.Web.UI.WebControls.DataGrid DataGrid1;
protected Wuqi.Webdiyer.AspNetPager AspNetPager2;
protected Wuqi.Webdiyer.AspNetPager AspNetPager1;
protected System.Web.UI.WebControls.DropDownList tdly;
private void Page_Load(object sender, System.EventArgs e)
{
if(!this.IsPostBack)
{
this.BindToPage();
}
// 在此处放置用户代码以初始化页面
}
private void BindToPage()
{
this.djdq.Attributes.Add("onChange","proform()");
SqlConnection con = DB.createCon();
con.Open();
SqlCommand cmd = new SqlCommand("select * from setsystem where Sort=2 order by place",con);
SqlDataReader sdr = cmd.ExecuteReader();
this.tdly.DataSource=sdr; this.tdly.DataTextField="setname";
this.tdly.DataValueField="ID";
this.tdly.DataBind();
this.tdly.Items.Insert(0,new ListItem("部门选择",""));
sdr.Close();
cmd.CommandText="select * from setsystem where Sort=1 order by place";
SqlDataReader sdr1 = cmd.ExecuteReader();
this.djdq.DataSource=sdr1; this.djdq.DataTextField="setname";
this.djdq.DataValueField="ID";
this.djdq.DataBind();
this.djdq.Items.Insert(0,new ListItem("地接地区",""));
this.djtd.Items.Insert(0,new ListItem("地接团队",""));
sdr1.Close(); cmd.CommandText="select * from line order by adddate desc";
SqlDataReader sdr2 = cmd.ExecuteReader();
this.xlmc.DataSource=sdr2;
this.xlmc.DataTextField="linename";
this.xlmc.DataValueField="ID";
this.xlmc.DataBind();
this.xlmc.Items.Insert(0,new ListItem("线路名称",""));
sdr2.Close();
} #region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load); }
#endregion private void Button1_Click(object sender, System.EventArgs e)
{
SqlConnection con = DB.createCon();
con.Open(); string StrSql="select count(upteam.ID) from upteam,team,line where team.ID=upteam.djtd and line.ID=upteam.xlmc ";
if(this.tdly.SelectedItem!=null && this.tdly.SelectedValue.ToString()!="")
{
StrSql=StrSql+" and upteam.tdly='"+this.tdly.SelectedValue.ToString()+"'";
}
if(this.course_code.Text!=null && this.course_code.Text.ToString()!="")
{
StrSql=StrSql+" and upteam.course_code='"+this.course_code.Text.ToString()+"'";
}
if(this.djdq.SelectedItem!=null && this.djdq.SelectedValue.ToString()!="")
{
StrSql=StrSql+" and upteam.djdq='"+this.djdq.SelectedValue.ToString()+"'";
}
// if(Request["djtd"].ToString()!="")
// {
// StrSql=StrSql+" and upteam.djtd='"+Request.Form["djtd"].ToString()+"'";
// }
if(this.xlmc.SelectedItem!=null && this.xlmc.SelectedValue.ToString()!="")
{
StrSql=StrSql+" and upteam.xlmc='"+this.xlmc.SelectedValue.ToString()+"'";
} SqlCommand cmd = new SqlCommand(StrSql,con);
this.AspNetPager1.RecordCount=(int)cmd.ExecuteScalar();
this.BindToDataGrid();
}
private void BindToDataGrid()
{
this.Panel1.Visible=false;
this.Panel2.Visible=true;
this.DataGrid1.Visible=true;
this.AspNetPager1.Visible=true;
SqlConnection con = DB.createCon();
SqlDataAdapter sda = new SqlDataAdapter();
string StrSql="select team.teamname,line.linename,upteam.ID,upteam.course_code,upteam.crs,upteam.ets,upteam.pts from upteam,team,line where team.ID=upteam.djtd and line.ID=upteam.xlmc ";
if(this.tdly.SelectedItem!=null && this.tdly.SelectedValue.ToString()!="")
{
StrSql=StrSql+" and upteam.tdly='"+this.tdly.SelectedValue.ToString()+"'";
}
if(this.course_code.Text!=null && this.course_code.Text.ToString()!="")
{
StrSql=StrSql+" and upteam.course_code='"+this.course_code.Text.ToString()+"'";
}
if(this.djdq.SelectedItem!=null && this.djdq.SelectedValue.ToString()!="")
{
StrSql=StrSql+" and upteam.djdq='"+this.djdq.SelectedValue.ToString()+"'";
}
// if(Request["djtd"].ToString()!="")
// {
// StrSql=StrSql+" and upteam.djtd='"+Request.Form["djtd"].ToString()+"'";
// }
if(this.xlmc.SelectedItem!=null && this.xlmc.SelectedValue.ToString()!="")
{
StrSql=StrSql+" and upteam.xlmc='"+this.xlmc.SelectedValue.ToString()+"'";
} StrSql=StrSql+" order by upteam.st_time desc,upteam.tdly";
// Response.Write(StrSql);
// Response.End();
sda.SelectCommand=new SqlCommand(StrSql,con);
DataSet ds = new DataSet(); sda.Fill(ds,this.AspNetPager1.PageSize*(this.AspNetPager1.CurrentPageIndex-1),this.AspNetPager1.PageSize,"upteam"); this.DataGrid1.DataKeyField="ID";
this.DataGrid1.DataSource=ds.Tables["upteam"];
this.DataGrid1.DataBind();
} private void AspNetPager1_PageChanged(object sender, Wuqi.Webdiyer.PageChangingEventArgs e)
{
this.AspNetPager1.CurrentPageIndex = e.NewPageIndex;
this.BindToDataGrid();
} }
}
解决方案 »
- 紧急,紧急!
- 如何实现页面结束提示?
- 关于TREEVIEW控件
- 吴旗娃的分页控件aspnetpager能用吗?根本实现不了带查询的分页,至少得用动态sql,我就奇怪这个东东为什么会得到大家的青睐>
- [讨论]关于MemberShip这套系统大家的看法
- 打开模式窗口确不能设置窗口大小
- asp.net里发邮件时提示“正在发送邮件...”,发送成功以后就自动消失,这个是怎么做的啊 ?
- 高手,,,请救呀,,,,,,,在线等
- 为何asp.net用<!--#include file="xxx.aspx"-->就不行了?
- 一个WEB程序,在多台服务器上同时运行,怎么弄?
- 生成自定义类时出现的问题,请大家帮帮忙。
- 各种平台,各种语言都可调用这个dll文件吗?
<%@ Page language="c#" Codebehind="searchTotal.aspx.cs" AutoEventWireup="false" Inherits="WelcomeSystem.searchTotal" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>地接团队</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="css/cssForMenu.css" type="text/css" rel="stylesheet">
<script language="javascript">
function proform(){
var TargetValue=document.all("djdq").value;
var Url="SearchTotalList.aspx";
Url=Url+"?SetID="+TargetValue;
document.frames["iframe1"].location.replace(Url);
}
</script>
<SCRIPT language="JavaScript" src="rl/date.js"></SCRIPT>
</HEAD>
<body bgColor="#efefef" leftMargin="0" topMargin="0">
<IFRAME id="CalFrame" style="DISPLAY: none; Z-INDEX: 100; WIDTH: 144px; POSITION: absolute; HEIGHT: 189px"
marginWidth="0" marginHeight="0" src="rl/calendar.htm" frameBorder="0" noResize scrolling="no"></IFRAME>
<table cellSpacing="0" cellPadding="0" width="100%" align="center" border="0">
<tr>
<td bgColor="#d1e9e9">
<table cellSpacing="0" cellPadding="0" width="100%" border="0">
<tr>
<td width="587" height="22"><strong><font color="#479696"> 所在位置>>综合信息</font></strong></td>
</tr>
</table>
</td>
</tr>
</table>
<br>
<form id="Form1" method="post" runat="server">
<asp:panel id="Panel1" runat="server">
<TABLE id="Table1" cellSpacing="1" cellPadding="5" width="600" align="center" bgColor="#ffffff"
border="0">
<TR bgColor="#f2fddf">
<TD colSpan="2"><IMG height="12" src="images/star1.gif" width="12"> 综合信息</TD>
</TR>
<TR>
<TD align="right" width="80">团队来源:</TD>
<TD>
<asp:DropDownList id="tdly" style="FONT-SIZE: 12px; FONT-FAMILY: Tahoma, 新宋体, sans-serif" runat="server"
Width="120"></asp:DropDownList></TD>
</TR>
<TR>
<TD align="right" width="80">团队编号:</TD>
<TD>
<asp:TextBox id="course_code" runat="server"></asp:TextBox></TD>
</TR>
<TR>
<TD align="right" width="80">启程时间:</TD>
<TD>
<asp:textbox id="st_time" runat="server"></asp:textbox> <A onclick="event.cancelBubble=true;" href="javascript:ShowCalendar(document.Form1.currentdate,document.Form1.st_time,null,0,330)"><IMG id="currentdate" height="21" src="rl/calendar.gif" width="34" align="absMiddle"
border="0"> <A onclick="event.cancelBubble=true;" href="javascript:ShowCalendar(document.form1.currentdate,document.form1.st_time,null,0,330)">
</A>
</TD>
</TR>
<TR>
<TD align="right" width="80"> </TD>
<TD>
<asp:textbox id="unpaied_time" runat="server"></asp:textbox> <A onclick="event.cancelBubble=true;" href="javascript:ShowCalendar(document.Form1.currentdate1,document.Form1.unpaied_time,null,0,330)"><IMG id="currentdate1" height="21" src="rl/calendar.gif" width="34" align="absMiddle"
border="0"></A>
</TD>
</TR>
<TR>
<TD align="right" width="80">地接地区:</TD>
<TD>
<asp:DropDownList id="djdq" style="FONT-SIZE: 12px; FONT-FAMILY: Tahoma, 新宋体, sans-serif" runat="server"
Width="168"></asp:DropDownList></TD>
</TR>
<TR>
<TD align="right" width="80">地接团队:</TD>
<TD><SPAN id="targetIframe">
<asp:DropDownList id="djtd" style="FONT-SIZE: 12px; FONT-FAMILY: Tahoma, 新宋体, sans-serif" runat="server"
Width="168"></asp:DropDownList>
</SPAN></TD>
</TR>
<TR>
<TD align="right" width="80">线路名称:</TD>
<TD>
<asp:DropDownList id="xlmc" style="FONT-SIZE: 12px; FONT-FAMILY: Tahoma, 新宋体, sans-serif" runat="server"
Width="360"></asp:DropDownList></TD>
</TR>
<TR>
<TD align="right" width="80">显示条件:</TD>
<TD>
<TABLE id="Table2" cellSpacing="1" cellPadding="3" width="100%" border="0">
<TR>
<TD> 团队编号</TD>
<TD> 组团社名称</TD>
<TD> 导游
</TD>
<TD> 成人
</TD>
<TD> 儿童</TD>
</TR>
<TR>
<TD> 陪同</TD>
<TD> 旅游线路</TD>
<TD> 团队来源</TD>
<TD> 地接地区</TD>
<TD> </TD>
</TR>
</TABLE>
</TD>
</TR>
<TR bgColor="#f2fddf">
<TD align="center" colSpan="2">
<asp:Button id="Button1" runat="server" Text="搜索信息"></asp:Button>
<asp:Button id="Button2" runat="server" Text="取消信息"></asp:Button></TD>
</TR>
</TABLE>
</asp:panel><asp:panel id="Panel2" runat="server" Visible="False">
<TABLE id="Table3" cellSpacing="5" cellPadding="5" width="300" border="0">
<TR>
<TD>
<asp:DataGrid id="DataGrid1" runat="server" Width="650px" Visible="False" PageSize="20" AutoGenerateColumns="False"
CellPadding="4" BackColor="White" BorderWidth="1px" BorderStyle="None" BorderColor="#EFEEF0">
<SelectedItemStyle Font-Bold="True" ForeColor="#663399" BackColor="#FFCC66"></SelectedItemStyle>
<ItemStyle ForeColor="Black" BackColor="White"></ItemStyle>
<HeaderStyle Font-Bold="True" ForeColor="Black" BackColor="#F2FDDF"></HeaderStyle>
<FooterStyle ForeColor="Black" BackColor="#F2FDDF"></FooterStyle>
<Columns>
<asp:BoundColumn DataField="ID" HeaderText="序号"></asp:BoundColumn>
<asp:BoundColumn DataField="course_code" HeaderText="编号"></asp:BoundColumn>
<asp:BoundColumn DataField="teamname" HeaderText="团队名称"></asp:BoundColumn>
<asp:BoundColumn DataField="linename" HeaderText="线路名称"></asp:BoundColumn>
<asp:BoundColumn DataField="crs" HeaderText="成人"></asp:BoundColumn>
<asp:BoundColumn DataField="ets" HeaderText="儿童"></asp:BoundColumn>
<asp:BoundColumn DataField="pts" HeaderText="陪同"></asp:BoundColumn>
<asp:BoundColumn DataField="ID" HeaderText="导游"></asp:BoundColumn>
</Columns>
<PagerStyle NextPageText="下一页" PrevPageText="上一页" HorizontalAlign="Center" ForeColor="Black"
BackColor="#F2FDDF"></PagerStyle>
</asp:DataGrid>
<webdiyer:AspNetPager id="AspNetPager1" runat="server" PageSize="20" HorizontalAlign="Right" ShowInputBox="Always"
NumericButtonTextFormatString="[{0}]" SubmitButtonText="转页"></webdiyer:AspNetPager></TD>
</TR>
</TABLE>
</asp:panel></form>
<iframe name="iframe1" width="0" height="0"></iframe>
</body>
</HTML>
另外AspNetPager 6.0也有vs2003版的,如果你是在项目中第一次用这个控件,那么建议用6.0版,因为新版改进了一些功能并修正了一些bug。
ShowInputBox="Always" NumericButtonTextFormatString="[{0}]" SubmitButtonText="转页"></webdiyer:AspNetPager> void ChangePage(object src,Wuqi.Webdiyer.PageChangingEventArgs e)
{
this.AspNetPager1.CurrentPageIndex=e.NewPageIndex;
this.BindToDataGrid();
}我现在这个加进去了,可是现在有错误说是编译器错误信息: CS0122: 不可访问“WelcomeSystem.searchTotal.ChangePage(object, Wuqi.Webdiyer.PageChangingEventArgs)”,因为它受保护级别限制源错误: 行 136: BackColor="#F2FDDF"></PagerStyle>
行 137: </asp:DataGrid>
行 138: <webdiyer:AspNetPager id="AspNetPager1" OnPageChanged="ChangePage" runat="server" PageSize="20" HorizontalAlign="Right"
行 139: ShowInputBox="Always" NumericButtonTextFormatString="[{0}]" SubmitButtonText="转页"></webdiyer:AspNetPager></TD>
行 140: </TR>
{
this.AspNetPager1.CurrentPageIndex=e.NewPageIndex;
this.BindToDataGrid();
}默认的级别不够,改为Public void ChangePage ()
{
this.AspNetPager1.CurrentPageIndex=e.NewPageIndex;
this.BindToDataGrid();
}我按照你们说的方法做了Public 或protected修饰了可是错误还是和刚才的一样了
编译器错误信息: CS0122: 不可访问“WelcomeSystem.searchTotal.ChangePage(object, Wuqi.Webdiyer.PageChangingEventArgs)”,因为它受保护级别限制
我真是服了到底是怎么了,这回用这个组件怎么这样啊
我快疯了