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

📄 defaultcs.aspx.cs

📁 Telerik是很大的第三方软件制造商
💻 CS
📖 第 1 页 / 共 4 页
字号:
using System;
using Telerik.WebControls;
using System.Web.UI.WebControls;
using Telerik.QuickStart;

namespace Telerik.GridExamplesCSharp.Programming.Hierarchy
{
	public abstract class DefaultCS : XhtmlPage
	{
		protected System.Data.OleDb.OleDbDataAdapter daOrderDetails;
		protected System.Data.OleDb.OleDbCommand oleDbDeleteCommand3;
		protected System.Data.OleDb.OleDbCommand oleDbInsertCommand3;
		protected System.Data.OleDb.OleDbCommand oleDbSelectCommand3;
		protected System.Data.OleDb.OleDbCommand oleDbUpdateCommand3;
		protected System.Data.OleDb.OleDbDataAdapter daOrders;
		protected System.Data.OleDb.OleDbCommand oleDbDeleteCommand2;
		protected System.Data.OleDb.OleDbCommand oleDbInsertCommand2;
		protected System.Data.OleDb.OleDbCommand oleDbSelectCommand2;
		protected System.Data.OleDb.OleDbCommand oleDbUpdateCommand2;
		protected System.Data.OleDb.OleDbDataAdapter daCustomers;
		protected System.Data.OleDb.OleDbCommand oleDbDeleteCommand1;
		protected System.Data.OleDb.OleDbCommand oleDbInsertCommand1;
		protected System.Data.OleDb.OleDbCommand oleDbSelectCommand1;
		protected System.Data.OleDb.OleDbCommand oleDbUpdateCommand1;
		protected GridTest1.dsNWind dsNWind1;
		protected System.Web.UI.WebControls.DataGrid DataGrid1;
		protected System.Web.UI.WebControls.Button Button1;
		protected System.Web.UI.WebControls.LinkButton Linkbutton2;
		protected System.Web.UI.WebControls.LinkButton Linkbutton1;
		protected System.Web.UI.WebControls.LinkButton Linkbutton4;
		protected System.Web.UI.WebControls.LinkButton Button2;
		protected System.Web.UI.WebControls.PlaceHolder PlaceHolder1;
		protected System.Data.OleDb.OleDbConnection oleDbConnection1;

		private Telerik.WebControls.RadGrid RadGrid1;

		private void DefineGridStructure()
		{
			this.RadGrid1 = new RadGrid();
			
			this.RadGrid1.NeedDataSource += new GridNeedDataSourceEventHandler(this.RadGrid1_NeedDataSource);
			this.RadGrid1.DetailTableDataBind += new  GridDetailTableDataBindEventHandler(this.RadGrid1_DetailTableDataBind);

			this.RadGrid1.CssClass = "RadGrid";

			this.RadGrid1.Width = Unit.Percentage(100);
			this.RadGrid1.PageSize = 5;
			this.RadGrid1.AllowPaging = true;
			this.RadGrid1.AllowSorting = true;
			this.RadGrid1.AutoGenerateColumns = false;

			//Master table - Customers (I in hierarchy level)
			this.RadGrid1.MasterTableView.DataMember = "Customers";
			this.RadGrid1.MasterTableView.PageSize = 15;

			//Add columns
			GridBoundColumn boundColumn;
			boundColumn = new GridBoundColumn();
			boundColumn.DataField = "CustomerID";
			boundColumn.HeaderText = "CustomerID";
			this.RadGrid1.MasterTableView.Columns.Add(boundColumn);

			boundColumn = new GridBoundColumn();
			boundColumn.DataField = "ContactName";
			boundColumn.HeaderText = "Contact Name";
			this.RadGrid1.MasterTableView.Columns.Add(boundColumn);


			//Detail table - Orders (II in hierarchy level)
			GridTableView tableViewOrders = new GridTableView(RadGrid1);
			tableViewOrders.DataMember = "Orders";
			this.RadGrid1.MasterTableView.DetailTables.Add( tableViewOrders );

			//Add columns
			boundColumn = new GridBoundColumn();
			boundColumn.DataField = "OrderID";
			boundColumn.HeaderText = "OrderID";
			tableViewOrders.Columns.Add(boundColumn);

			boundColumn = new GridBoundColumn();
			boundColumn.DataField = "OrderDate";
			boundColumn.HeaderText = "Date Ordered";
			tableViewOrders.Columns.Add(boundColumn);

			//Detail table Order-Details (III in hierarchy level)
			GridTableView tableViewOrderDetails = new GridTableView(RadGrid1);
			tableViewOrderDetails.DataMember = "OrderDetails";
			tableViewOrders.DetailTables.Add( tableViewOrderDetails );

			boundColumn = new GridBoundColumn();
			boundColumn.DataField = "UnitPrice";
			boundColumn.HeaderText = "Unit Price";
			tableViewOrderDetails.Columns.Add(boundColumn);

			boundColumn = new GridBoundColumn();
			boundColumn.DataField = "Quantity";
			boundColumn.HeaderText = "Quantity";
			tableViewOrderDetails.Columns.Add(boundColumn);

			//Add the RadGrid instance to the controls
			this.PlaceHolder1.Controls.Add( RadGrid1 );
		}


		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			this.DefineGridStructure();
			InitializeComponent();
			base.OnInit(e);
		}
		
		///		Required method for Designer support - do not modify

⌨️ 快捷键说明

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