473,387 Members | 1,455 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Please Help - Allow Paging on Grid Properties Builder

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_S electedIndexChanged);
this.gridLegalEntityEmployee.PageIndexChanged += new
System.EventHandler(this.gridLegalEntityEmployee_P ageIndexChanged );

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

}

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

=== Error ======
this.gridLegalEntityEmployee_PageIndexChanged =>
'cpNET.WebForm1.gridLegalEntityEmployee_PageIndexC hanged(object,
System.Web.UI.WebControls.DataGridPageChangedEvent Args)' 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
Nov 17 '05 #1
1 1579
you page index changed event is mapped to the wrong handler
it should be
System.Web.UI.WebControls.DataGridPageChangedEvent Handler instead of
system.eventhandler

"Eddy Soeparmin" <es********@clientprofiles.com> wrote in message
news:Oy*************@TK2MSFTNGP11.phx.gbl...
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_S electedIndexChanged);
this.gridLegalEntityEmployee.PageIndexChanged += new
System.EventHandler(this.gridLegalEntityEmployee_P ageIndexChanged );

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

}

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

=== Error ======
this.gridLegalEntityEmployee_PageIndexChanged =>
'cpNET.WebForm1.gridLegalEntityEmployee_PageIndexC hanged(object,
System.Web.UI.WebControls.DataGridPageChangedEvent Args)' 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

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: David Petersen | last post by:
I need to change the paging buttons in my C# web datagrid from "previous" and "next" to something like "Records 10-20 of 100", etc., depending on which page the user is on. Any ideas? Thanks,...
0
by: Eddy Soeparmin | last post by:
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...
1
by: Christopher Pragash | last post by:
Hello All I am having a pretty wired problem...I am writing a web part (SPS 2003) that uses a Datagrid. In the web part, I create the datagird assign some properties and add event handlers for...
4
by: Happy | last post by:
hi I got a datagrid with Paging enabled which is getting populated thru a stored proc. I've given the code in the event grid.CurrentPageIndex = e.NewPageIndex grid.VirtualItemCount =...
2
by: Luis Esteban Valencia | last post by:
I have a data grid control with a templated checkbox column residing in a asp.net user control. The checkbox boolean state determines if the item is later added or removed from another database...
59
by: Alan Silver | last post by:
Hello, This is NOT a troll, it's a genuine question. Please read right through to see why. I have been using Vusual Basic and Classic ASP for some years, and have now started looking at...
2
by: Daniel Walzenbach | last post by:
Hi, I have a question regarding the DataGrid control. If paging is enabled the grid binds the data, sets the paging on the top/bottom (or however it is set up) and throws away unnecessary...
3
by: Pat | last post by:
I have a 2 nested Datagrid. When i select a row in the Master Datagrid i populate the Child databrid using myDataGrid.SelectedIndex value as the filter and setting the DataKeyField. I enabled...
1
by: =?Utf-8?B?TG95b2xhIHN0YWxpbg==?= | last post by:
Hi, I am using ASP.Net 2.0 version and Windows'XP OS. I am useing the Grid view control to display the user details along with the paging concept provided by the grid view control. When i...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.