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

ImageButton in an RadGrid template column doesn’t fire ItemCommand event when EnableViewState is set to false

1 Answer 137 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ricard Bertran Vall
Top achievements
Rank 1
Ricard Bertran Vall asked on 20 Apr 2011, 11:05 AM

Hi everyone,

I’ve to load a large amount of data in a RadGrid and in order to improve performance I would like to disable the RadGrid ViewState.

My RadGrid just show data and let the user to click in some image buttons to do some actions with the selected row.

When I set the EnableViewState to false, I’ve found the RadGrid1_ItemCommand event doesn’t fire when you click on the Image button but it does when you click on a link button.




<telerik:GridTemplateColumn FilterControlAltText="" UniqueName="TemplateColumn6">

<ItemTemplate>

<!--ImageButton doesn't fire the RadGrid1_ItemCommand event -->

<asp:ImageButton ID="ImageButton1" runat="server" CommandName="Imprimir2" ImageUrl="printer3.png"

CausesValidation="false" />

<!--LinkButton fires the RadGrid1_ItemCommand event-->

<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="false" CommandName="Imprimir"

Text="Print" CssClass="myCssStyle"></asp:LinkButton>

</ItemTemplate>

</telerik:GridTemplateColumn>


Best regards,

1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 21 Apr 2011, 09:15 AM
Hello Ricard Bertran Vall,

I have already addressed the bug report you have submitted on the same topic. To make it available for our community, I am pasting my post here as well:

Indeed the reported behavior is observed when RadGrid's viewstate is disabled. Unfortunately, this is a limitation of the control. To workaround it you have to stop the viewstate of the grid's parent control. For example you can place the grid inside a panel and stop its viewstate:

<asp:Panel runat="server" EnableViewState="false">
       <telerik:RadGrid ID="RadGrid1" runat="server" ... >
            ...
       </telerik:RadGrid>
</asp:Panel>

I hope this helps.

Best wishes,
Martin
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.

Tags
Grid
Asked by
Ricard Bertran Vall
Top achievements
Rank 1
Answers by
Martin
Telerik team
Share this question
or