Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 3rd, 2007, 09:55 AM
Authorized User
 
Join Date: Jul 2007
Location: Staten Island, NY, USA.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default Events issue for programatically created GridView

I have create GridView programatically with the statement:
System.Web.UI.WebControls.GridView gvProgrm = new GridView();

then create to events hendlers:

protected void gvProgrm_PageIndexChanging(object sender, GridViewPageEventArgs e)
protected void gvProgrm_Sorting(object sender, GridViewSortEventArgs e)

and Delegates:

 this.gvProgrm.Sorting += new System.EventHandler(this.gvProgrm_Sorting);
        this.gvProgrm.PageIndexChanging += new System.EventHandler(this.gvProgrm_PageIndexChangin g);

but when I run my Website I' ve got an error:

Compiler Error Message: CS0123: No overload for 'gvProgrm_Sorting' matches delegate 'System.EventHandler'

Source Error:



Line 25: private void InitializeComponent()
Line 26: {
Line 27: this.gvProgrm.Sorting += new System.EventHandler(this.gvProgrm_Sorting);

Please advise

Thanks

Vadim



  #2 (permalink)  
Old July 4th, 2007, 02:48 AM
Friend of Wrox
Points: 1,935, Level: 17
Points: 1,935, Level: 17 Points: 1,935, Level: 17 Points: 1,935, Level: 17
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2004
Location: United Kingdom
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
Default

Change your event reference as below:

this.gvProgrm.Sorting += new GridViewSortEventHandler(this.gvProgrm_Sorting);

Regards
Mike

Don't expect too much, too soon.
  #3 (permalink)  
Old July 5th, 2007, 07:34 AM
Authorized User
 
Join Date: Jul 2007
Location: Staten Island, NY, USA.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Mike,
It was helpful - it fixed my problem.

  #4 (permalink)  
Old July 5th, 2007, 08:11 AM
Friend of Wrox
Points: 1,935, Level: 17
Points: 1,935, Level: 17 Points: 1,935, Level: 17 Points: 1,935, Level: 17
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2004
Location: United Kingdom
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
Default

Glad I could help.

Regards
Mike

Don't expect too much, too soon.
  #5 (permalink)  
Old July 5th, 2007, 05:11 PM
Authorized User
 
Join Date: Jul 2007
Location: Staten Island, NY, USA.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Mike,
    could you pls take a look on my another topic:
"Paging in gridview control"

Thanks

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Issue of changing IPAddress programatically in win sraja C# 2005 1 March 6th, 2008 05:55 AM
Fire Events from Nested GridView adamh409 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 2 November 5th, 2007 01:18 PM
TextBox issues when created programatically nkommala ASP.NET 1.x and 2.0 Application Design 3 October 9th, 2006 11:59 PM
Tricky DataGrid Events Issue DudeBori82 ASP.NET 1.0 and 1.1 Professional 3 October 21st, 2005 04:26 PM
Events for multiple dynamically created controls Puck312 Pro VB 6 5 August 29th, 2005 03:05 PM



All times are GMT -4. The time now is 04:20 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.