This is a migrated thread and some comments may be shown as answers.

Error 109 No overload for 'grid_ItemCommand' matches delegate 'Telerik.Web.UI.GridCommandEventHandler'

5 Answers 899 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Neal
Top achievements
Rank 1
Neal asked on 03 Apr 2009, 10:46 AM
Hi all,

I had the following, (which worked till I upgraded my Controls)
a method which returned via an arraylist any and all RadGrids found on a page ..i.e.

Logger.findRadGrids(Page.Controls);
which is as follows

 

    public RadGrid findRadGrids(ControlCollection collection)

 

    {

 

        RadGrid result;

 

 

        foreach (Control ctrl in collection)

 

        {

 

            if (ctrl.Controls.Count > 0)

 

            {

                result = findRadGrids(ctrl.Controls);

 

                if (result != null)

 

                {

                    RadGrids.Add(result);

                }

            }

 

            else if (ctrl.GetType() == typeof(RadGrid))

 

            {

                RadGrids.Add(ctrl);

            }

 

            else if (ctrl.GetType() == typeof(Telerik.Web.UI.RadGrid))

 

            {

                RadGrids.Add(ctrl);

            }

        }

 

return null;

 

}


I then iterated thru this arraylist...getting the ItemCommand which I could then validate commandtypes against authorizations per user.
and log these.
//Originally...

 

foreach (RadGrid grid in Logger.RadGrids)

 

 

{

 

 

 grid.ItemCommand += new GridCommandEventHandler(grid_ItemCommand);

 

 

}
//Now (mixed versions of RadCtls  requiring .WebControls and .Web.UI )

 

for

(int i = 0; i < Logger.RadGrids.Count; ++i)

 

{

 

    if (Logger.RadGrids[i].GetType() == typeof(Telerik.Web.UI.RadGrid))

 

    {

        Telerik.Web.UI.

RadGrid grid = (Telerik.Web.UI.RadGrid)Logger.RadGrids[i];

 

 

        grid.ItemCommand +=

new Telerik.Web.UI.GridCommandEventHandler( grid_ItemCommand);

 

    }

 

    else

 

 

 

    {

        Telerik.WebControls.

RadGrid grid = (Telerik.WebControls.RadGrid)Logger.RadGrids[i];

 

        grid.ItemCommand +=

new GridCommandEventHandler( grid_ItemCommand);

 

    }

}

 


//Authorize or disallow actions on Grids

 

 

public void grid_ItemCommand(object source, GridCommandEventArgs e)

 

{

 

GridDataItem dataItem = new GridDataItem(((RadGrid)source).MasterTableView, 0, 0);

 

 

Hashtable htValues = new Hashtable();

 

 

switch (e.CommandName)

 

{

 

case RadGrid.UpdateCommandName:

 

{

 

if (!PagePrivilege.EditData)

 

{

disallowAction(

"Not allowed to Edit any Data");

 

e.Canceled =

true;

 

}

dataItem = ((

GridDataItem)((RadGrid)source).EditItems[0]);

 

 

goto extract;

 

}

 

case RadGrid.DeleteCommandName:

 

{

 

if (!PagePrivilege.DeleteData)

 

{

disallowAction(

"Not allowed to Delete any Data");

 

e.Canceled =

true;

 

}

dataItem = e.Item

as GridDataItem;

 

 

goto extract;

 

}

 

case RadGrid.PerformInsertCommandName:

 

{

 

if (!PagePrivilege.AddData)

 

{

disallowAction(

"Not allowed to insert any Data");

 

e.Canceled =

true;

 

}

((

RadGrid)source).MasterTableView.GetInsertItem().ExtractValues(htValues);

 

 

goto logg;

 

}

extract:

{

dataItem.ExtractValues(htValues);

 

goto logg;

 

}

logg:

{

 

this.Logger.logEvent(e.CommandName, htValues, 1);

 

 

break;

 

}

 

default:

 

{

 

break;

 

}

}

 


Now with the new versions of the controls, this generated the following error

Error 109 No overload for 'grid_ItemCommand' matches delegate 'Telerik.Web.UI.GridCommandEventHandler' 

How do I go about fixing this please


TIA
Neal

5 Answers, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 06 Apr 2009, 03:42 PM
Hello Neal,

The signature of the ItemCommand handler of your grid seems correct, however in some places in your code I see that you have references to the Telerik.WebControls namespace for the ASP.NET version of the grid. Is it possible that some kind of collision between the Telerik.Web.UI and Telerik.WebControls namespace causes the error?

Additionally, check whether specifying the type of the second argument in the ItemCommand handler produces different result, namely:

public void grid_ItemCommand(object source, Telerik.Web.UI,GridCommandEventArgs e)

Best regards,
Sebastian
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Neal
Top achievements
Rank 1
answered on 07 Apr 2009, 06:55 AM
Thanks,
You are quite right/
(I have q4 2006 and q1 2009 RadAjax asp.net controls ..and hence the conflict)...Now (for the interim I have differentiated between them and added the same function for the Web.UI ,..and both run great.

Thx
0
maina
Top achievements
Rank 1
answered on 26 Jan 2011, 01:49 AM
I have the same problem in OnItemDataBound. I have some basic question. How do I find out the conflicting Teleric dlls and how do I resolve it?
0
Veli
Telerik team
answered on 31 Jan 2011, 08:44 AM
Hi maina,

You need to see what components your project references and remove any older references to Telerik RadControls. If you have WebSite project (different from WebApplication project), check web.config to make sure the web site does not reference any old version of RadControls from the Globacl Assembly Cache (GAC) or any other location.

Veli
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Neal
Top achievements
Rank 1
answered on 31 Jan 2011, 11:41 AM
Hi Maina,

Firstly
You can check the refresh path of your telerik.Web.Ui.dll (expand the node on Telerik.Web.UI.dll, in the Bin folder of your WebSite) to see the dll.Refresh ..sorta text container, which you can edit to the path where the new Controls were / are installed) .
My new updated instalation of Telerik Controls (2008), was put into the root folder of of my IIS folders..as per Telerik Suggestion/Documentation) ..eg

C:\Inetpub\wwwroot\Telerik_RadControls2009.1

2ndly
.........All my References to it, in each form/class...were changed to
using Telerik.Web.UI;

3rdy the Event handlers on my grids/controls all reference the correct telerik dll
eg.     grvSchedule_InsertCmd(object source, Telerik.Web.UI.GridCommandEventArgs e)

4thly...the Web.Config  icluding the MS Script resource handlers, Web Extensions and their Correct Versions

 

<

 

system.web>
    <
httpHandlers

              <

 

add path="Telerik.Web.UI.DialogHandler.aspx" verb="*" type="Telerik.Web.UI.DialogHandler,
                           Telerik.Web.UI, Culture=neutral, PublicKeyToken=121fae78165ba3d4
" validate="false"/>

 

              <

 

add path="Telerik.Web.UI.SpellCheckHandler.axd" verb="*" type="Telerik.Web.UI.SpellCheckHandler,
                         Telerik.Web.UI, Culture=neutral, PublicKeyToken=121fae78165ba3d4
" validate="false"/>

 

             <

 

add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false"/>

 

</

 

httpHandlers>

 

</

 

system.web>

 

<

 

system.webServer>

 

           <

 

handlers>

 

                     <

 

remove name="WebServiceHandlerFactory-Integrated"/>

 

                      <

 

add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
                                 type
="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, 
                                 Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
"/>

 

                      <

 

add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd"
                                preCondition
="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory,
                               System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
                               PublicKeyToken=31bf3856ad364e35
"/>

 

                       <

 

add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD"
                                 path
="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler,
                                 System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
                                 PublicKeyToken=31bf3856ad364e35
"/>

 

                      <

 

add name="Telerik_Web_UI_WebResource_axd" verb="*" preCondition="integratedMode"
                               path
="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource"/>

 

</

 

handlers>

 

</

 

system.webServer>

Remember the MS System.Web.Extensions / resources if using asp:Scriptmanager as opposed to using the telerik Scriptmanger (Required for Ajax Callbacks).


If you still have problems,..clean the GAC (in some deep hidden directory somewhere)  bit of a mission,..but search Telerik and Google that for more instructions.

rgds
Neal

 

 

 

 

 

 

 

 

 

 

 

 

 

Tags
Grid
Asked by
Neal
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Neal
Top achievements
Rank 1
maina
Top achievements
Rank 1
Veli
Telerik team
Share this question
or