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

ItemCommand Event

1 Answer 97 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Neil asked on 04 Nov 2012, 03:49 PM
I have a RadGrid that I added an ItemCommand event to. The UI uses Twitter Bootstrap to open a modal window, this window has a textbox and a send button with a command name and command argument.  When I click the button, I get :

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.

<telerik:RadGrid ID="MyGrid" OnItemCommand="MyGrid_ItemCommand"
        Skin="Sitefinity" AllowSorting="True" AutoGenerateColumns="false" AllowPaging="True"
        PageSize="10" runat="server" GridLines="None" Width="100%">
        <PagerStyle EnableSEOPaging="true" SEOPagingQueryStringKey="p" Mode="NumericPages">
                <telerik:GridTemplateColumn HeaderStyle-Font-Bold="true">
                <telerik:GridTemplateColumn HeaderStyle-Font-Bold="true" HeaderText="Progress">
                        <div class="progress progress-success progress-striped" style="position: relative;
                            top: 10px;">
                            <asp:Panel runat="server" ID="progressBar" EnableViewState="false" CssClass="bar progress">
                <telerik:GridTemplateColumn HeaderStyle-Font-Bold="true" HeaderText="Manage" ItemStyle-Width="220px">
                        <div class="btn-group">
                            <asp:HyperLink ID="matchLink" CssClass="btn" runat="server" Style="color: #333 !important;"
                                Text="<i class='icon-check'></i> Match" />
                            <button class="btn dropdown-toggle" data-toggle="dropdown">
                                <span class="caret"></span>
                            <ul class="dropdown-menu">
                                <li><a href="#message" data-toggle="modal"><i class='icon-envelope-alt'></i>Send Message</a></li>
                                    <asp:LinkButton ID="downloadLinks" runat="server" Text="<i class='icon-download-alt'></i> Download Data" /></li>
                        <!-- Modal -->
                        <div id="message" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                                <h3 id="myModalLabel">
                                    Send Message</h3>
                            <div class="modal-body">
                                    <asp:TextBox TextMode="MultiLine" ID="messageTextBox" Width="500px" placeholder="Type your message here…"
                                        runat="server" Rows="10"></asp:TextBox>
                            <div class="modal-footer">
                                <button class="btn" data-dismiss="modal" aria-hidden="true">
                                <asp:Button ID="sendMessageButton" CommandName="SendMessage" CommandArgument='<%#Eval("Id")%>'
                                    CssClass="btn btn-primary" Text="Send" runat="server" />

protected void MyGrid_ItemCommand(object sender, GridCommandEventArgs e)
            // code

1 Answer, 1 is accepted

Sort by
Top achievements
Rank 2
answered on 05 Nov 2012, 05:02 AM

Unfortunately I canot replicate the error at my end. After inspecting your code I suppose you are binding the grid in page load. Make sure that you are using advanced data binding using its NeedDataSource event to bind the grid. Hope this helps.

Asked by
Top achievements
Rank 1
Answers by
Top achievements
Rank 2
Share this question