Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 85693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:07:46+00:00 2026-05-10T22:07:46+00:00

I have Datalist that is inside an updatepanel and it is in panel in

  • 0

I have Datalist that is inside an updatepanel and it is in panel in modalpopupextender;

I can list items as I wanted. I am also putting 2 buttons for Delete and AddBelow. Here is the markup:

<asp:DataList ID='SpeedDialsDL' runat='server'>                 <ItemTemplate>                     <table id='speedDialValueEditorTable' width='100%'>                         <tr>                             <td width='275px'>                                 <asp:Label ID='ValueLabel' runat='server' Text='Value'></asp:Label>                             </td>                             <td>                                 <asp:TextBox ID='ValueTextBox' runat='server' Text='<%# Eval('Value') %>' Width='340px'                                     Enabled='false'></asp:TextBox>                             </td>                         </tr>                                                <tr>                             <td colspan='2'>                                 <asp:Button ID='Delete' runat='server' Text='Delete' CommandName='Delete'                                  CausesValidation='false' />&nbsp;                                 <asp:Button ID='AddNewButton' runat='server' Text='AddBelow' CommandName='AddBelow'                                    CausesValidation='false' />                             </td>                         </tr>                     </table>                 </ItemTemplate>             </asp:DataList> 

And register evenst like following: (I have used both ItemCommand and DeleteCommand to see which works:)

protected void Page_Load(object sender, EventArgs e) {     SpeedDialsDL.ItemCommand += SpeedDialsDL_ItemCommand;     SpeedDialsDL.DeleteCommand += SpeedDialsDL_ItemCommand;             }          void SpeedDialsDL_ItemCommand(object source, DataListCommandEventArgs e) {     switch (e.CommandName)     {         case 'Delete':             this.DeleteFromList((string)e.CommandArgument);             break;         case 'AddBelow':             break;     } } 

But when I click Delete Or AddBelow buttons I get following error:

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. 

I have disabled eventvalidation of page but the event couldn’t be caught…

What am I missing here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T22:07:46+00:00Added an answer on May 10, 2026 at 10:07 pm

    A control registers its events during rendering and then validates the events during the post-back or callback handling. You’re registering the events manually during Page_Load.

    Try refactoring your code so you specify the event handler in the .aspx page, bind the item’s Id to the button’s CommandArgument, then get the bound item Id in the handler. I would also have separate event handlers for the different events, it’s a little cleaner. Something like:

    <asp:DataList ID='SpeedDialsDL' runat='server'>                 <ItemTemplate>                         <table id='speedDialValueEditorTable' width='100%'>                                 <tr>                                         <td width='275px'>                                                 <asp:Label ID='ValueLabel' runat='server' Text='Value'></asp:Label>                                         </td>                                         <td>                                                 <asp:TextBox ID='ValueTextBox' runat='server' Text='<%# Eval('Value') %>' Width='340px' Enabled='false'></asp:TextBox>                                         </td>                                </tr>                                                        <tr>                                         <td colspan='2'>                                                 <asp:Button ID='Delete' runat='server' Text='Delete' OnClick='Delete' CausesValidation='false' CommandArgument='<%# Eval('Id') %>' />                 <asp:Button ID='AddNewButton' runat='server' Text='AddBelow' OnClick='AddBelow' CausesValidation='false' CommandArgument='<%# Eval('Id') %>' />                                         </td>                              </tr>                        </table>                 </ItemTemplate>             

    protected void Delete(object sender, EventArgs e) {     Button b = (Button)sender as Button;     string boundItemId = b.CommandArgument;     //handle delete }  protected void AddBelow(object sender, EventArgs e) {     Button b = (Button)sender as Button;     string boundItemId = b.CommandArgument;     //handle add below } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a datalist inside a usercontrol that gets loaded into a page where
I have a DataList control that displays a set of elements. Can anyone point
I have a datalist that contains a gridview inside its itemtemplate. on the item-data_bound
I have a DataList that Displays some Posts with a RadioButtonList inside where it
I have a datalist that receives values from a MySQL database. This datalist can
I have a DataList and inside of each item there is an ImageButton that
I have a DataList inside a DataList that causes my page to lose the
Kinda hard to explain, but i'll try. I have a datalist that is populated
I have a datalist being generated with ASP, but unfortunately the jQuery script that
I have a table that is created in a DataList in ASP.Net. This table

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.