Hi all,
I have a Rad grid with a column template like the following:
<
telerik:GridTemplateColumn
HeaderText
=
"Actions"
UniqueName
=
"Actions"
>
<
ItemTemplate
>
<
div
class
=
"sfBasicLangs"
>
<
asp:ImageButton
runat
=
"server"
CommandName
=
"delete"
OnCommand
=
"Delete"
/>
</
div
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
the Delete method present in the OnCommand is never fired.... how can have radGrid fire it.
I've already tried to enable viewstate on the grid
Thanks,
Mattia
13 Answers, 1 is accepted


method 1 :
<
asp:ImageButton
runat
=
"server"
CommandName
=
"Userdelete"
>ItemCommand()
{
if(e.CommandName == "
Userdelete
"){
// write your logic here
}
}
method 2 :
<
asp:ImageButton
runat
=
"server"
CommandName
=
"Delete"
>Deletecommand()
{
// wrote your logic here
}
Thanks,
Jayesh Goyani

thanks for the answer but I have already implemented the Delete function... The problem is that the function is never fired.
Thanks,
Mattia

I was unable to recreate the issue at my end. Please make sure that you have attached the event correctly. Here am pasting the full code.
aspx:
<
telerik:RadGrid
AllowAutomaticUpdates
=
"true"
ID
=
"RadGrid1"
runat
=
"server"
DataSourceID
=
"SqlDataSource1"
AllowPaging
=
"True"
CellSpacing
=
"0"
GridLines
=
"None"
OnItemCommand
=
"RadGrid1_ItemCommand"
>
<
MasterTableView
DataKeyNames
=
"OrderID"
PageSize
=
"10"
AllowFilteringByColumn
=
"true"
CommandItemDisplay
=
"Top"
AutoGenerateColumns
=
"False"
EditMode
=
"InPlace"
>
<
columns
>
<
telerik:GridBoundColumn
DataField
=
"ShipCountry"
FilterControlAltText
=
"Filter ShipCountry column"
HeaderText
=
"ShipCountry"
SortExpression
=
"ShipCountry"
UniqueName
=
"ShipCountry"
>
</
telerik:GridBoundColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"Actions"
UniqueName
=
"Actions"
>
<
ItemTemplate
>
<
asp:ImageButton
ID
=
"ImageButton1"
runat
=
"server"
CommandName
=
"delete"
OnCommand
=
"Delete"
/>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
C#:
protected
void
Delete(
object
sender, CommandEventArgs e)
{
}
protected
void
RadGrid1_ItemCommand(
object
sender, GridCommandEventArgs e)
{
}
Thanks,
Princy.

i found the problem. The command is fired only if I do the databinding in the Page_Load.
The problem is that I need to have the value of a dropdown to filter the datasource and, as far as the Page_Load event if fired before the controls event I always get the old value.
If I can only bind the grid in the page load how I can I accomplish this?
Thanks,
Mattia
Please examine this help topic to see how the desired functionality can be implemented.
I hope it helps.
Kind regards,
Mira
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.

I solved my problem by binding the grid with a objectDataSource instead of manually doing it in dropdown onSelectedIndexChanged event.
But I still don't understand why if I do it manually in the onSelectedIndexChanged event the commands are not fired.
Thanks,
Mattia
In order the RadGrid to work correct, you should data-bind it properly.
Please examine the Telerik RadGrid data binding basics help topic and the Data-binding help section for additional information.
I hope this helps.
All the best,
Mira
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.

i have asp:imageButton in radgrid templete column.When i click on the imagebutton i am getting javascript runtime error "unable to get the property 'style' of undefined or null reference. this is comming only on IE.when i run the page in crome script error is not coming.i added style property to image button.
With Regards
Bharath.

If I am not wrong than this is the IE version specific issue. Please make sure you used latest telerik version.
If you are not able to resolved this issue than please provide your code snippet.
The error was thrown from dadgrid's in-built js file. So, if we add the external style than also it will not resolved your existing issue.
Let me know if any concern.
Thanks,
Jayesh Goyani

My radgrid inside the update panel.When i removed update panel i am not getting the script error.
With Regards
Bharath

As per my knowledge there are multiple reason for this.
So could you please provide your grid code including update panel?
Thanks,
Jayesh Goyani

HI Jayesh Goyani,
i need to create dynamic radgrid with DropdownBox and checkBox . After getting the datasourse i need to check values of corresponding columns and need to do check or uncheck and selected item for dropdown.
After pageload with the above i need to change the dropdownbox values and checkbox chek or uncheck.
after i have to saved the latest values of radgrid by Button click event which is out side of grid.
can you guide on this and create a sample page.
/Bharath