⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bookresearch.aspx.cs

📁 客户关系管理系统
💻 CS
字号:
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;

namespace HKeBookshop
{
	/// <summary>
	/// bookreserach 的摘要说明。
	/// </summary>
	public class bookreserach : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.DropDownList DropDownList1;
		protected System.Web.UI.WebControls.Button Button1;
		protected System.Web.UI.WebControls.DataGrid DataGrid1;
		protected System.Web.UI.WebControls.TextBox bookname;
		string sql;
		string strsql="";
		myclass MyClass = new myclass();
		DataSet ds = new DataSet();
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			
				sql = "select * from T_booktype ";
				ds = MyClass.Readdate(sql);
				this.DropDownList1.DataTextField ="booktype";
				this.DropDownList1.DataValueField = "id";
				this.DropDownList1.DataSource = ds;
				this.DropDownList1.DataBind();	
			
					

		}

		#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.DataGrid1.ItemCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid1_ItemCommand);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		private void Button1_Click(object sender, System.EventArgs e)
		{
			sql = "select [bookid],[bookname],[write],[booktypeid] from [T_bookinfo] where bookname like '%" + bookname.Text + "%' and booktypeid = "+ DropDownList1.SelectedItem .Value; 
			ds = MyClass.Readdate(sql);
			DataGrid1.DataSource = ds;
			DataGrid1.DataBind();
		}

		private void DataGrid1_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
		{
			if (e.CommandName == "Select")
			{
				Response.Redirect("showbookdet.aspx?bookid=" + e.Item.Cells[0].Text);
			}
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -