📄 meetingfind.aspx.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class meetingfind : System.Web.UI.Page
{
SqlConnection cn;
DataSet ds = new DataSet();
protected void Page_Load(object sender, EventArgs e)
{
}
public static string pagecount;
private void databindfindmeetinginfo()
{
int countpage = Convert.ToInt32(this.Labelye.Text);
cn = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["cn"]);
cn.Open();
SqlDataAdapter da = new SqlDataAdapter("select* from meeting where builder='" + Convert.ToString(Session["username"]) + "'and name='"+this.txtname .Text .Trim ()+"'and addr='"+this.ddlroompos .SelectedItem .Value .ToString ()+"'and attr='"+this.ddlattr .SelectedItem .Value .ToString ()+"' order by id desc", cn);
da.Fill(ds, "Result");
System.Web.UI.WebControls.PagedDataSource ps = new PagedDataSource();
ps.DataSource = ds.Tables["Result"].DefaultView;
ps.AllowPaging = true;
ps.PageSize = 12;
ps.CurrentPageIndex = countpage - 1;
this.lblPageCount.Text = Convert.ToString(ps.PageCount);
this.Button2.Enabled = true;
this.Button3.Enabled = true;
if (countpage == 1)
{
this.Button2.Enabled = false;
}
if (countpage == ps.PageCount)
{
this.Button3.Enabled = false;
}
this.gvmyjionmeeting.DataSource = ps;
this.gvmyjionmeeting.DataBind();
if (this.gvmyjionmeeting.Rows.Count == 0)
{
this.Panel1.Visible = false;
this.Labmessage.Text = "温馨的提示:没有找到要搜索的会议内容!";
}
else
{
this.Panel1.Visible = true;
}
SqlCommand cmd = new SqlCommand ("select count(*) from meeting where builder='" + Convert.ToString(Session["username"]) + "'and name='" + this.txtname.Text.Trim() + "'and addr='" + this.ddlroompos.SelectedItem.Value.ToString() + "'and attr='" + this.ddlattr.SelectedItem.Value.ToString() + "'", cn);
this.lblRecordCount.Text = Convert.ToString(cmd.ExecuteScalar());
pagecount = Convert.ToString(ps.PageCount);
cn.Close();
}
protected void Button1_Click(object sender, EventArgs e)
{
this.Labelye.Text = "1";
this.databindfindmeetinginfo();
}
protected void Button2_Click(object sender, EventArgs e)
{
this.Labelye.Text = Convert.ToString(Convert.ToInt32(this.Labelye.Text) - 1);
this.databindfindmeetinginfo();
}
protected void Button3_Click(object sender, EventArgs e)
{
this.Labelye.Text = Convert.ToString(Convert.ToInt32(this.Labelye.Text) + 1);
this.databindfindmeetinginfo();
}
protected void Button4_Click(object sender, EventArgs e)
{
this.Labelye.Text = pagecount;
this.databindfindmeetinginfo();
}
protected void gvmyjionmeeting_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#ffffff';");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c;");
}
}
protected void Button5_Click(object sender, EventArgs e)
{
if (this.IsValid)
{
this.databindfindmeetinginfo();
}
}
protected void Button6_Click(object sender, EventArgs e)
{
this.Labmessage.Text = "";
this.Panel1.Visible = false;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -