Please Help - Allow Paging on Grid Properties Builder

  • Thread starter Thread starter Eddy Soeparmin
  • Start date Start date
E

Eddy Soeparmin

Hi,

I'm working on a grid when the database returns ... say 100 rows. I would
like to use the Allow Page in the grid Properties, but don't really know how
to code it right. I copied some code from the help, but it doesn't really
work yet. The compiler complains on the following...

private void InitializeComponent()
{
this.gridLegalEntityEmployee.SelectedIndexChanged += new
System.EventHandler(this.gridLegalEntityEmployee_SelectedIndexChanged);
this.gridLegalEntityEmployee.PageIndexChanged += new
System.EventHandler(this.gridLegalEntityEmployee_PageIndexChanged );

this.Load += new System.EventHandler(this.Page_Load);

}

private void gridLegalEntityEmployee_PageIndexChanged( object source,
System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
gridLegalEntityEmployee.CurrentPageIndex = e.NewPageIndex;
gridLegalEntityEmployee.DataBind();
}

=== Error ======
this.gridLegalEntityEmployee_PageIndexChanged =>
'cpNET.WebForm1.gridLegalEntityEmployee_PageIndexChanged(object,
System.Web.UI.WebControls.DataGridPageChangedEventArgs)' does not match
delegate 'void System.EventHandler(object, System.EventArgs)'

Here is some other sniplet code

================================================================
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
gridLegalEntityEmployee.AllowPaging = true;
gridLegalEntityEmployee.PagerStyle.Mode = PagerMode.NumericPages;
gridLegalEntityEmployee.PagerStyle.PageButtonCount = 15;
gridLegalEntityEmployee.PageSize = 15;

LoadLegalEntityEmployeeList();

if (!Page.IsPostBack)
{
gridLegalEntityEmployee.DataBind();
}
}

private void LoadLegalEntityEmployeeList()
{
LegalEntityEmployee leEmployee = new LegalEntityEmployee();

// Retrieve data from database
gridLegalEntityEmployee.DataSource = leEmployee.SelectAll();

// Bind it to Databind
gridLegalEntityEmployee.DataBind();
}
================================================================

I know there is a stupid mistake I made here, but I just cant't see it. Any
suggestion or recommeded is greatly appreciated. I really appriciate you
guys help.

Thanks a lot.

Eddy
 
you page index changed event is mapped to the wrong handler
it should be
System.Web.UI.WebControls.DataGridPageChangedEventHandler instead of
system.eventhandler
 
Back
Top