Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 3rd, 2007, 09:55 AM
Authorized User
 
Join Date: Jul 2007
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



 
Old July 4th, 2007, 02:48 AM
Friend of Wrox
 
Join Date: Aug 2004
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.
 
Old July 5th, 2007, 07:34 AM
Authorized User
 
Join Date: Jul 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

 
Old July 5th, 2007, 08:11 AM
Friend of Wrox
 
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
Default

Glad I could help.

Regards
Mike

Don't expect too much, too soon.
 
Old July 5th, 2007, 05:11 PM
Authorized User
 
Join Date: Jul 2007
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






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





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