|
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
// ---------------------------------------------------------
// Tony Truong's ExpandGridSample
// Copyright (C) 2004
// For further reference see http://www.codeproject.com
// ---------------------------------------------------------
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Gorth.ExDataGrids;
namespace ExpandGridSample
{
/// <summary>
/// Summary description for WebForm1.
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
protected Gorth.ExDataGrids.ExDataGrid DataGridReport1;
private void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{
// Put user code to initialize the page here
DataSet ds = new DataSet();
ds.ReadXml(AppDomain.CurrentDomain.BaseDirectory + @"\Testdata.xml");
Session["ExDataGridDemo"] = ds.Tables[0];
DataGridReport1.DataSource = ds.Tables[0];
DataGridReport1.DataBind();
}
}
#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);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.DataGridReport1.SortCommand += new System.Web.UI.WebControls.DataGridSortCommandEventHandler(this.OnSort);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void OnSort(object source, System.Web.UI.WebControls.DataGridSortCommandEventArgs e)
{
DataTable aDT = (DataTable) Session["ExDataGridDemo"];
DataGridReport1 = (ExDataGrid) source;
string sNewSortExpression = e.SortExpression.ToString();
DataView dv = aDT.DefaultView;
dv.Sort = sNewSortExpression;
DataGridReport1.DataSource=aDT;
DataGridReport1.DataBind();
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
Tony Truong graduated from UCLA in Spring of 2001 and starting worked at Symantec Corporation as a Software Engineer. After a few years of developing various features for Norton SystemWorks, Tony moved to San Diego. He is currently writing database applications using ASP.NET and C# with the .NET Framework. Tony specializes in tara-byte databases with emphasis on high availability, optimization, and complex entity modeling.