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

Invalid postback or callback argument.

2 Answers 133 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Ilona asked on 22 Sep 2010, 10:49 AM

I try to set up a RadGrid with a delete-icon to delete a record. When the delete-button in the GridButtonColumn is from type LinkButton it works fine. But when I change it to an ImageButton to show the delete-icon, I get the following error when deleting a record:

Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

The error appears after the confirmationdialog. I tried the Classic confirmationdialog, but it didn't help.

Any ideas?

    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
    <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
            <telerik:AjaxSetting AjaxControlID="grdPlaylistItems">
                    <telerik:AjaxUpdatedControl ControlID="grdPlaylistItems" LoadingPanelID="RadAjaxManagerLoadingPanel1" />
    <telerik:RadWindowManager ID="RadWindowManager1" Skin="Windows7" runat="server">
    <asp:Label ID="lblTitlePlaylistItems" runat="server"><strong>Playlist Items</strong></asp:Label>
    <telerik:RadGrid ID="grdPlaylistItems" runat="server">
        <MasterTableView TableLayout="Fixed">
                <telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="DeleteColumn"
                    ButtonType="ImageButton" ImageUrl="../images/icons/remove.png" HeaderStyle-Width="30px"
                    ConfirmDialogType="RadWindow" ConfirmDialogHeight="100px" ConfirmText="Are you sure you want to delete this item?"
                    ConfirmTitle="Delete playlist item">
                <telerik:GridTemplateColumn HeaderStyle-Width="70px" HeaderText="Thumbnail">
                        <asp:Image ID="imgThumbnail" runat="server" />
                <telerik:GridBoundColumn DataField="ItemName" HeaderText="Name" HeaderStyle-Width="200px">
                <telerik:GridBoundColumn DataField="PlaylistItemType" HeaderText="Type" HeaderStyle-Width="70px">
                <telerik:GridBoundColumn DataField="ItemDuration" HeaderText="Duration" HeaderStyle-Width="120px">
                <telerik:GridBoundColumn DataField="SortOrder" HeaderText="SortOrder" UniqueName="SortOrder"
                    HeaderStyle-Width="45px" Visible="true">

2 Answers, 1 is accepted

Sort by
Telerik team
answered on 22 Sep 2010, 02:01 PM
Hi Ilona,

The issue that you described is most probably due to databinding issues for the control.
From the I see that you are directly setting the datasource for the control and calling DataBind(). Please, keep in mind that this is not a recommended approach. To make sure that the control is properly maintained, please use Advanced Databinding.

I hope this information helps.

All the best,
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Top achievements
Rank 1
answered on 23 Sep 2010, 09:42 AM
Hi Pavlina,

I thought it was a strange connection between the Link/ImageButton and the way of DataBinding, but it works with the advanced databinding.

Unfortunately in the DeleteCommand event I don't have the e.Item.DataItem property anymore, is that right?
It looks like the grid isn't binded at that point. I solved it with the DataKeyValue, so no problem.

Asked by
Top achievements
Rank 1
Answers by
Telerik team
Top achievements
Rank 1
Share this question