实现自定义分页(如:改变传统datagrid的分页显示、通过A-Z的字母来分页等)、选择的check,实现自定义分页(如:改变传统datagrid的分页显示、通过A-Z的字母来分页等)、选择的check
【 tulaoshi.com - ASP.NET 】
代码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 DataGridDemoCS{ /// /// Demo1 的摘要说明。 /// public class DemoFinal : System.Web.UI.Page { protected System.Data.SqlClient.SqlConnection sqlConnection1; protected System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1; //注意:dataset在编辑状态中将清空,所以可以将dataset申明为static,这样就可以保持dataset状态; //静态成员变量不可以用this来调用 protected DataGridDemoCS.dsCustomers dsCustomers1; protected DataGridDemoCS.dsCustomers.CustomersDataTable dsCustomerTable; protected DataGridDemoCS.dsCustomers.CustomersRow dsCustomerRow; protected System.Data.SqlClient.SqlCommand sqlSelectCommand1; protected System.Data.SqlClient.SqlCommand sqlInsertCommand1; protected System.Data.SqlClient.SqlCommand sqlUpdateCommand1; protected System.Data.SqlClient.SqlCommand sqlDeleteCommand1; protected System.Data.SqlClient.SqlConnection sqlConnection2; protected System.Web.UI.WebControls.Button Button1; protected System.Web.UI.WebControls.Button BtnInsertOneRow; protected System.Web.UI.WebControls.Button BtnDeleteGrouply; protected System.Web.UI.WebControls.Panel PnlPage; protected System.Data.DataView dv; protected System.Data.SqlClient.SqlDataAdapter sqlDataAdapter2; protected System.Data.SqlClient.SqlConnection sqlConnection3; protected System.Web.UI.WebControls.DataGrid DataGrid1; public int ExpandedItem=7; public Unit HostColumnWidth; private DataGrid detailsGrid; const string ExpandText = "+"; protected System.Data.SqlClient.SqlCommand sqlSelectCommand2; protected System.Data.SqlClient.SqlCommand sqlInsertCommand2; protected System.Data.SqlClient.SqlCommand sqlUpdateCommand2; protected System.Data.SqlClient.SqlCommand sqlDeleteCommand2; protected System.Web.UI.WebControls.Button Button2; const string CollapseText = "-"; private void Page_Load(object sender, System.EventArgs e) { // 在此处放置用户代码以初始化页面 if (!Page.IsPostBack) { ExpandedItem = -1; testWorkFlow=""; ViewState["Sort"]="CustomerID"; ViewState["orderby"]="asc"; bindDate(); BtnDeleteGrouply.Attributes.Add("OnClick","javascript:DeleteGrouply();"); HostColumnWidth = Unit.Pixel(150); } } void bindDate() { testWorkFlow=""; sqlDataAdapter1.Fill(dsCustomers1,"Customers"); if ((string)(ViewState["Sort"])!="") dv.Sort=(string)ViewState["Sort"]+" "+ViewState["orderby"]; else dsCustomers1.Customers.DefaultView.Sort="CustomerID"; if ((string)(ViewState["alpha"])!="") { dv.RowFilter="CustomerID LIKE '"+(string)(ViewState["alpha"])+"%'"; } DataGrid1.DataBind(); m_CreatePageTimes=0; } #region Web 窗体设计器生成的代码 override protected void OnInit(EventArgs e) { // // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。 // InitializeComponent(); base.OnInit(e); } /// /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// private void InitializeComponent() { this.sqlConnection1 = new System.Data.SqlClient.SqlConnection(); this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter(); this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlConnection2 = new System.Data.SqlClient.SqlConnection(); this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand(); this.dsCustomers1 = new DataGridDemoCS.dsCustomers(); this.dv = new System.Data.DataView(); this.sqlDataAdapter2 = new System.Data.SqlClient.SqlDataAdapter(); this.sqlDeleteCommand2 = new System.Data.SqlClient.SqlCommand(); this.sqlConnection3 = new System.Data.SqlClient.SqlConnection(); this.sqlInsertCommand2 = new System.Data.SqlClient.SqlCommand(); this.sqlSelectCommand2 = new System.Data.SqlCl来源:http://www.tulaoshi.com/n/20160129/1487419.html
看过《实现自定义分页(如:改变传统datagrid的分页显示、通过A-Z的字母来分页等)、选择的check》的人还看了以下文章 更多>>