📄 defaultcs.aspx.cs
字号:
using System;
using Telerik.QuickStart.Grid;
using Telerik.WebControls;
using Telerik.QuickStart;
namespace Telerik.GridExamplesCSharp.Hierarchy.ThreeLevel
{
public abstract class DefaultCS : XhtmlPage
{
protected Telerik.WebControls.RadGrid RadGrid1;
protected System.Web.UI.WebControls.Button Button1;
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
RadGrid1.NeedDataSource += new GridNeedDataSourceEventHandler(RadGrid1_NeedDataSource);
this.Load += new EventHandler(Page_Load);
}
#endregion
private void RadGrid1_NeedDataSource(object source, Telerik.WebControls.GridNeedDataSourceEventArgs e)
{
if (!e.IsFromDetailTable)
{
RadGrid1.DataSource = DataSourceHelperCS.GetDataTable("SELECT * FROM Customers");
}
RadGrid1.MasterTableView.DetailTables[0].DataSource = DataSourceHelperCS.GetDataTable("SELECT * FROM Orders");
RadGrid1.MasterTableView.DetailTables[0].DetailTables[0].DataSource = DataSourceHelperCS.GetDataTable("SELECT * FROM [Order Details]");
}
private void Page_Load(object sender, EventArgs e)
{
if ( !IsPostBack )
{
//Setting Selected index prior to binding RadGrid:
//If the index is in detail table, parent items will be expanded
//automatically
RadGrid1.SelectedIndexes.Add(1, 0, 1, 0, 0);
//Index of 1, 0, 2, 0, 0 means:
//1 - item with index 1 in MasterTabelView
//0 - detail table with index 0
//1 - second (index 1) item in the detail table
//0 - 0 sub-detail
//1 - sub detail item with index 0
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -