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

Invalid postback or callback argument.

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

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?

<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
    <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="grdPlaylistItems">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="grdPlaylistItems" LoadingPanelID="RadAjaxManagerLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManagerProxy>
    <telerik:RadWindowManager ID="RadWindowManager1" Skin="Windows7" runat="server">
    </telerik:RadWindowManager>
    <asp:Label ID="lblTitlePlaylistItems" runat="server"><strong>Playlist Items</strong></asp:Label>
    <telerik:RadGrid ID="grdPlaylistItems" runat="server">
        <MasterTableView TableLayout="Fixed">
            <Columns>
                <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:GridButtonColumn>
                <telerik:GridTemplateColumn HeaderStyle-Width="70px" HeaderText="Thumbnail">
                    <ItemTemplate>
                        <asp:Image ID="imgThumbnail" runat="server" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridBoundColumn DataField="ItemName" HeaderText="Name" HeaderStyle-Width="200px">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="PlaylistItemType" HeaderText="Type" HeaderStyle-Width="70px">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="ItemDuration" HeaderText="Duration" HeaderStyle-Width="120px">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="SortOrder" HeaderText="SortOrder" UniqueName="SortOrder"
                    HeaderStyle-Width="45px" Visible="true">
                </telerik:GridBoundColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>
    </form>
</body>

2 Answers, 1 is accepted

Sort by
0
Pavlina
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,
Pavlina
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
0
Ilona
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.

Thanks!
Tags
Grid
Asked by
Ilona
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Ilona
Top achievements
Rank 1
Share this question
or