I have a grid that when I am setting its edit column button type of imageButton,like this:
</telerik:GridButtonColum
if ButtonType =ImageButton Button doesn't get to RadGrid1_ItemCommand
I know the solution:
to do DataBind if not postback.
But to me it does not help, because I have a search button each time to refresh the data grid and must be DataBind even in case postback.
What should I do?(My code in vb.net)
Thanks Ayelet
8 Answers, 1 is accepted
Go through the forum thread below which elaborates on this matter and let me know if it is useful for you:
http://www.telerik.com/community/forums/aspnet-ajax/grid/radgrid-itemcommand-not-firing-for-buttontype-imagebutton.aspx
Kind regards,
Pavlina
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Thanks for the link. But I have carefully read all suggestions and it did not help my case ...
Do you have another idea?
In the example you gave the attached sample project in the Page_Load have there:
RadGrid1.ItemCommand += new GridCommandEventHandler(RadGrid1_ItemCommand);
When I wrote it I had my project error:'Public Event itemcommand...' is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event.
My project is written on vb.
How can I overcome the error in vb.net?
Do you have another idea to solve the problem?
Thanks Ayelet
The error states that somewhere in your code you have a statement such as the one below:
ItemCommand(....)
where as you cannot call event delegates in this way as they will automatically triggered by the framework. Could you paste you complete code-behind?
Kind regards,
Pavlina
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Here's the relevant code:
Imports
Telerik.Web.UI
Public
Class wfrmProjects_List2 
#Region
" Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.
DebuggerStepThrough()> Private Sub InitializeComponent()
Me.PageLevel = CType(2, Short)
End Sub
Protected WithEvents btnSearch As System.Web.UI.WebControls.ImageButton
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
InitializeComponent()
 End Sub
Private ProjectsList As Logic.lgcProjects_List
Protected WithEvents RadGrid1 As RadGrid
Protected WithEvents mdlRange As mdlProjects_Range
Protected Overrides Sub WebForm_Load(ByVal sender As Object, ByVal e As System.EventArgs)
If IsPostBack Then
ProjectsList =
CType(Context.Session(C_S_PROJECTS_LIST), Logic.lgcProjects_List)
If Not (ProjectsList Is Nothing) AndAlso RadGrid1.DataSource Is Nothing Then
RadGrid1.DataSource = ProjectsList.getProjectsTable
RadGrid1.DataBind()
End If
End Sub
Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click
btnPrint.Enabled = True
ProjectsList =
New Logic.lgcProjects_List
FillData(
True)
End Sub
Private Sub FillRangeFromLogic()
...
End Sub
Private Sub FillData(ByVal FormSearch As Boolean)
...
strReportParameters = strReportParameters & " Opened: Closed"
ProjectsList.SearchProjects()
Context.Session(C_S_PROJECTS_LIST) = ProjectsList 
RadGrid1.DataSource = ProjectsList.getProjectsTable
'If Not IsPostBack Then
RadGrid1.DataBind()
' End If
End Sub
Protected Sub RadGrid1_ItemCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.ItemCommand
If (e.CommandName = "Details") Then
Context.Session(C_Q_PROJECTS_IDENTIFIER) = ProjectsList.getProjectsTable.Rows(
DirectCast(e.Item, Telerik.Web.UI.GridDataItem).ItemIndex)("ProjectID")
Response.Redirect(C_P_PROJECT_NAVIGATION_LIST, True)
ElseIf (e.CommandName = "Delete") Then
Dim SelectedValue As String = ProjectsList.getProjectsTable.Rows(DirectCast(e.Item, Telerik.Web.UI.GridDataItem).ItemIndex)("ProjectID")
Try
lgcManager.Delete(
"sp_DELETE_Tbl_Projects", CInt(SelectedValue), "@par_ProjectID")
Catch
End Try
End If
End Sub  
End
Class
<%@ Register TagPrefix="uc1" TagName="mdlProjects_Range" Src="../../Modules/Ranges/mdlProjects_Range.ascx" >
<%@ Page Language="vb" MasterPageFile="~/Modules/MasterPage/NewMaster.Master" AutoEventWireup="false" Codebehind="wfrmProjects_List2.aspx.vb" Inherits="Web.wfrmProjects_List2"%>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:content id="MPRange" runat="server" ContentPlaceHolderID="MPRange">
<uc1:mdlProjects_Range id="MdlRange" runat="server"></uc1:mdlProjects_Range>
</asp:content>
<asp:Content id="MPGridCon" runat="server" ContentPlaceHolderID="MPGrid">
<tr>
<td>
<div dir ="ltr">
<telerik:RadAjaxManagerProxy runat="server" ID="RadAjaxManagerProxy">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="Button1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="Button1" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="RadGrid1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid1" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManagerProxy>
</div>
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
</telerik:RadScriptManager>
<div id="Div1" align="left" dir="rtl" runat="server">
<telerik:RadGrid ID="RadGrid1" runat="server" AlternatingItemStyle-CssClass="TableHeaderAltEng"
AccessKeyAllowSorting="True" AllowPaging="True" AutoGenerateColumns="false" PageSize="5"
ShowFooter="false" ShowHeader="true" OnItemCommand="RadGrid1_ItemCommand"
CssClass ="GridBorders" EnableAJAX="true" EnableViewState =true
BorderWidth="0px" AllowMultiRowSelection="true" AllowSorting ="true" GridLines="Both" Width ="840" >
<MasterTableView Width="100%" ShowHeadersWhenNoRecords="true" InsertItemDisplay="Top"
GroupLoadMode="Server" AllowMultiColumnSorting="true" >
<Columns>
<telerik:GridButtonColumn UniqueName="Delete" ItemStyle-CssClass="TelerikTable" ItemStyle-Width="6%" HeaderStyle-Width="6%" ImageUrl="~/Images/NewDesign/icons-table-delete.png" HeaderStyle-HorizontalAlign="Center"
HeaderStyle-CssClass="ColumnHeader" HeaderText="Delete" ButtonType ="ImageButton" ItemStyle-ForeColor="White" ConfirmText ="Delete??" ItemStyle-HorizontalAlign="Center" CommandName="Delete" >
<HeaderStyle Width="7%"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" />
</telerik:GridButtonColumn>
<telerik:GridButtonColumn ItemStyle-Width="6%" HeaderStyle-Width="6%" ImageUrl="~/Images/NewDesign/icons-table-details.png" HeaderStyle-HorizontalAlign="Center"
HeaderStyle-CssClass="ColumnHeader" ButtonType ="ImageButton" HeaderText="Details" ItemStyle-ForeColor="White" ItemStyle-CssClass ="TelerikTable" UniqueName="ProjectID" ItemStyle-HorizontalAlign="Center" CommandName="Details" >
<HeaderStyle Width="7%"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" />
</telerik:GridButtonColumn>
<telerik:GridBoundColumn ItemStyle-CssClass="TelerikTable" HeaderText="Description" DataField="Description" UniqueName="Description"
HeaderStyle-Font-Underline="false" HeaderStyle-Font-Bold=true SortExpression="Description" HeaderStyle-Width = "8%" HeaderStyle-HorizontalAlign="Center">
<HeaderStyle CssClass="RadGridHeader"></HeaderStyle>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn ItemStyle-CssClass="TelerikTable" HeaderText="ModelDesc" DataField="ModelDesc" UniqueName="ModelDesc" ItemStyle-HorizontalAlign ="Center"
HeaderStyle-CssClass="ColumnHeader" SortExpression="ModelDesc" HeaderStyle-Width = "7%" HeaderStyle-HorizontalAlign="Center">
<HeaderStyle CssClass="RadGridHeader"></HeaderStyle>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn ItemStyle-CssClass="TelerikTable" HeaderText="CompanyEnglishName" DataField="CompanyEnglishName" UniqueName="CompanyEnglishName" ItemStyle-HorizontalAlign ="Center"
HeaderStyle-CssClass="ColumnHeader" SortExpression="CompanyEnglishName" HeaderStyle-Width = "7%" HeaderStyle-HorizontalAlign="Center">
<HeaderStyle CssClass="RadGridHeader"></HeaderStyle>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn ItemStyle-CssClass="TelerikTable" HeaderText="ProjectCategoryDesc" DataField="ProjectCategoryDesc" UniqueName="ProjectCategoryDesc" ItemStyle-HorizontalAlign ="Center"
HeaderStyle-CssClass="ColumnHeader" SortExpression="ProjectCategoryDesc" HeaderStyle-Width = "6%" HeaderStyle-HorizontalAlign="Center">
<HeaderStyle CssClass="RadGridHeader"></HeaderStyle>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn ItemStyle-CssClass="TelerikTable" HeaderText="Proj No" DataField="ProjectNum" UniqueName="ProjectNum" ItemStyle-HorizontalAlign ="Center"
HeaderStyle-CssClass="ColumnHeader" SortExpression="ProjectNum" HeaderStyle-Width = "7%" HeaderStyle-HorizontalAlign="Center">
<HeaderStyle CssClass="RadGridHeader" Width="50px"></HeaderStyle>
</telerik:GridBoundColumn>
</Columns>
<HeaderStyle CssClass="RadGridHeader"></HeaderStyle>
</MasterTableView>
<ClientSettings EnableRowHoverStyle="true">
<Selecting AllowRowSelect="true" />
</ClientSettings>
</telerik:RadGrid>
</div>
</asp:Content>
<asp:content id="MPFooterButtons" runat="server" ContentPlaceHolderID="MPFooterButtons">
<DIV align=left dir="rtl" >
<asp:ImageButton ID="btnPrint" runat="server" ImageUrl = "~/Images/NewDesign/btns-low-print.png" />
<asp:ImageButton ID="btnAdd" runat="server" ImageUrl = "~/Images/NewDesign/btns-low-add.png" />
</DIV>
</asp:content>
if you have a solution very appreciate it ...
Thanks Ayelet

Have you seen the code? What's the problem I do not get to item command? Could you please help me?
Thanks Ayelet
Thank you for the provided code. However, I was not able to reproduce the issue you are facing as you can see from the test project attached to this message. Please check it out and let me know what is the difference in your scenario.
Best wishes,
Pavlina
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.

RadGrid1.ItemCommand +=
new GridCommandEventHandler(RadGrid1_ItemCommand);
And it noted that I could not do in vb (see correspondence above ..)
Do you have the same pattern on vb? Register for events there is a difference between c # to vb and it seems to me where the problem ...
Do you have an example of the same code on vb that works well ? (with imagebutton and item_command...)
Thanks Ayelet
I am not sure that we are testing the same project.The project which I sent you in the previous post is in VB.NET and the ItemCommand event is catched as shown below:
Protected
Sub
RadGrid1_ItemCommand(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.Web.UI.GridCommandEventArgs)
Handles
RadGrid1.ItemCommand
Let me know what I am missing out.
All the best,
Pavlina
the Telerik team