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

Invalid postback or callback argument

1 Answer 148 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Krish Singh
Top achievements
Rank 1
Krish Singh asked on 09 Mar 2010, 09:55 AM

Hi every one,

 

I am using telerik:GridButtonColumn it's working on Mozila firefox but does not work on chrome, when I click on gridbuttoncolumn it throws an error mention below:


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.

 

aspx code:

 

<telerik:RadFormDecorator ID="blueMapsFormDecorator" runat="server" DecoratedControls="all"

                Skin="Web20"></telerik:RadFormDecorator>

           

            <telerik:RadGrid AutoGenerateColumns="False" ID="gdListAccountDeactivate" AllowFilteringByColumn="true"

                Width="100%" AllowPaging="True" AllowSorting="True" AllowRowSelect="true" runat="server"

                OnItemCommand="gdListAccountDeactivate_ItemCommand">

                <ClientSettings>

                    <Selecting AllowRowSelect="True" />     

                </ClientSettings>

                <PagerStyle Mode="NextPrevAndNumeric" />

                <GroupingSettings CaseSensitive="false" />

                <MasterTableView TableLayout="Fixed">

                    <Columns>

                       <telerik:GridBoundColumn HeaderText="EmailID" DataField="emailID" ItemStyle-Width="200px"

                        SortExpression="emailID" HeaderStyle-Width="200px" FilterControlWidth="180px"

                        AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" />

                                                

                       <telerik:GridButtonColumn ConfirmText="Deactivate this User?" ConfirmDialogType="RadWindow" HeaderStyle-HorizontalAlign="Center"

                        ConfirmTitle="Deactivate" ButtonType="ImageButton" ImageUrl="~/images/delete.gif" CommandName="Deactivate" Text="Deactivate"

                        UniqueName="DeleteColumn" HeaderText="Deactivate" ItemStyle-Width="50px" HeaderStyle-Width="50px">

                        <itemstyle horizontalalign="Center" cssclass="MyImageButton" />

                        </telerik:GridButtonColumn>

                    

                     <telerik:GridTemplateColumn UniqueName="appuserid" AllowFiltering="false" AutoPostBackOnFilter="false" ItemStyle-Width="50px" HeaderStyle-Width="50px" >

                        <ItemTemplate>

                            <telerik:RadTextBox Visible="false" ID="appUser" runat="server" Text='<%# Bind("appuserid") %>'>

                            </telerik:RadTextBox>

                            <asp:LinkButton ID="LinkButton2" Width="50px" CommandName="Redirect"

                                Text="Portfolio" runat="server"></asp:LinkButton>

                        </ItemTemplate>

                    </telerik:GridTemplateColumn>  

                       

                    </Columns>

                </MasterTableView>

            </telerik:RadGrid><br />

            <telerik:RadWindowManager ID="RadWindowManager2" runat="server"></telerik:RadWindowManager>

 

aspx.cs code:

 

protected void gdListAccountDeactivate_ItemCommand(object source, GridCommandEventArgs e)

    {

        if (e.CommandName == "Redirect")

        {

            GridDataItem item = (GridDataItem)e.Item;

            string ID = (item.FindControl("appUser") as RadTextBox).Text;

            string url = "Portfolio.aspx?ID=" + Security.QueryStringEncode(ID);

            Response.Redirect(url);

        }

        if (e.CommandName == "Deactivate")

        {

            GridDataItem item = (GridDataItem)e.Item;

            string appID = (item.FindControl("appUser") as RadTextBox).Text;

            int appuserid = Convert.ToInt32(appID);

            int lastupdatedby = Convert.ToInt32(Session["appuserid"]);

            Member objMember = new Member();

            objMember.DeactivateAccount(appuserid, lastupdatedby);

            BindGrid();

        }

    }

public void BindGrid()

    {

        int ImplementationID = 0;

        if (Session["ImplementationID"] == "")

        {

            ImplementationID = 0;

            ds = objAccount.FetchUser("Account Manager", ImplementationID);

        }

 

        if (ds.Tables[0].Rows.Count > 0)

        {

            gdListAccountDeactivate.DataSource = ds.Tables[0];

            gdListAccountDeactivate.DataBind();

        }

    }

Thanks

1 Answer, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 11 Mar 2010, 12:11 PM
Hello krish,

You need to use Advanced databinding as opposed to Simple databinding. Therefore, just move your databinding logic to the NeedDataSource event and call the grid's Rebind() method when you need to rebind the grid ouside of that event.

I hope it helps.

Greetings,
Tsvetoslav
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.
Tags
Grid
Asked by
Krish Singh
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Share this question
or