///
/// This method is called when a page is loaded.
///
/// The object that raised the load event.
/// The object that contains the event data of the load event.
private void MyPageLoad(object sender, System.EventArgs e)
{
if (!this.IsPostBack)
{
System.Web.UI.WebControls.DataGrid myDataGrid = ((System.Web.UI.WebControls.DataGrid)(this.FindControlRecursively("myDataGrid")));
// If DataGrid is found then populate it.
if (!(myDataGrid == null))
{
// example of where clause is
// whereStr = " myNumericField = 1"
// whereStr = " myStrField = '1'"
string whereStr = null;
// Create orderBy clause
BaseClasses.Data.OrderBy ob = null;
// Set page index and size
int pageIndex = 0;
int pageSize = 1000;
// Retrieving first 1000 records.
// Bind the result set to the DataGrid.
myDataGrid.DataSource = ${${Table Name}ClassName}.GetDataTable(whereStr, ob, pageIndex, pageSize);
myDataGrid.DataBind();
}
}
}
|