repeater item command in asp.net

Koray Durudogan

i am working with asp.net and i have a repeater.I want to take a respond from one of the items, which has been displayed by repeater.Here is my code:

<asp:Repeater ID="Repeatercart" runat="server" OnItemCommand ="RepeaterDeleteitemcommand" >
<ItemTemplate>                     
    <table> 
    <tr>
        <td><img id="Image1" src="PerfumeImages/<%#Eval("ProductImage") %>" width="90" /></td>
    </tr>                               
    <tr>
        <td><%#Eval("ProductName") %> x<%#Eval("Quantity") %></td>
    </tr>
    <tr>
        <td> <%#Eval("ProductGender") %></td>
    </tr>
    <tr>
        <td> <%#Eval("ProductSize") %> ml</td>
    </tr>                               
    <tr>
        <td><a class="buy-btn"><asp:Button ID="Button1" CommandName="Click" Text="Remove from cart" runat="server" CommandArgument='<%# Eval("ProductId") %>' /></a></td>
    </tr>
    </table>            
</ItemTemplate>
</asp:Repeater>   

and this is my codebehind:

protected void RepeaterDeleteitemcommand(object source, RepeaterCommandEventArgs e)
{
    switch (e.CommandName)
    {
        case "Click":
               Label1.Text = "ok !";
               break;
    }
}  

When i run this code, i get an error like: Invalid postback or callback argument. Event validation is enabled using 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.Thanks for the help

Koray Durudogan

I solved the problem and wanted to write here, so i can help anyone with the same problem.Adding an "if (!IsPostBack)" under the pageload is solving the problem.Thanks for the all help.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

NavigateUrl on Repeater ASP.net

From Dev

ASP .NET Using a Repeater inside of UpdatePanel with UpdateProgress

From Dev

ASP.NET Repeater - Eval() for bool?

From Dev

Hiding the first item of an ASP.NET Repeater causes error: not a valid identifier

From Dev

asp.net repeater use template in javascript

From Dev

to disable a label of repeater on some condition in asp .net

From Dev

Using Bootstrap tabs with ASP NET repeater

From Dev

Is there an ASP.NET databindable control (like Repeater), which only expects a single item?

From Dev

asp.net repeater for each row

From Dev

jQuery is not finding Asp.net repeater alternating item

From Dev

To bind images in repeater using asp.net

From Dev

asp.net repeater merge columns dynamically

From Dev

Convert Bootstrap Carousel to ASP.Net Repeater

From Dev

Fix header row in repeater in ASP.NET

From Dev

ASP.NET Repeater Item add divider after each row

From Dev

NavigateUrl on Repeater ASP.net

From Dev

Delete an item from an asp:Repeater using jQuery

From Dev

ASP.NET repeater only renders the first item in my XML data source

From Dev

ASP.NET Converting repeater item to the textbox

From Dev

Is there an ASP.NET databindable control (like Repeater), which only expects a single item?

From Dev

Repeater asp.net tag not working

From Dev

asp.net repeater merge columns dynamically

From Dev

Convert Bootstrap Carousel to ASP.Net Repeater

From Dev

Conditional statement for Repeater Controll in ASP.NET

From Dev

Fix header row in repeater in ASP.NET

From Dev

trying Image Button in repeater Asp.net

From Dev

asp net dropdown selectedvalue/selectedindex not updating in repeater

From Dev

ASP.Net - Issues with Repeater / DataBinding

From Dev

Repeater in asp.net from DB with DropDownList

Related Related

  1. 1

    NavigateUrl on Repeater ASP.net

  2. 2

    ASP .NET Using a Repeater inside of UpdatePanel with UpdateProgress

  3. 3

    ASP.NET Repeater - Eval() for bool?

  4. 4

    Hiding the first item of an ASP.NET Repeater causes error: not a valid identifier

  5. 5

    asp.net repeater use template in javascript

  6. 6

    to disable a label of repeater on some condition in asp .net

  7. 7

    Using Bootstrap tabs with ASP NET repeater

  8. 8

    Is there an ASP.NET databindable control (like Repeater), which only expects a single item?

  9. 9

    asp.net repeater for each row

  10. 10

    jQuery is not finding Asp.net repeater alternating item

  11. 11

    To bind images in repeater using asp.net

  12. 12

    asp.net repeater merge columns dynamically

  13. 13

    Convert Bootstrap Carousel to ASP.Net Repeater

  14. 14

    Fix header row in repeater in ASP.NET

  15. 15

    ASP.NET Repeater Item add divider after each row

  16. 16

    NavigateUrl on Repeater ASP.net

  17. 17

    Delete an item from an asp:Repeater using jQuery

  18. 18

    ASP.NET repeater only renders the first item in my XML data source

  19. 19

    ASP.NET Converting repeater item to the textbox

  20. 20

    Is there an ASP.NET databindable control (like Repeater), which only expects a single item?

  21. 21

    Repeater asp.net tag not working

  22. 22

    asp.net repeater merge columns dynamically

  23. 23

    Convert Bootstrap Carousel to ASP.Net Repeater

  24. 24

    Conditional statement for Repeater Controll in ASP.NET

  25. 25

    Fix header row in repeater in ASP.NET

  26. 26

    trying Image Button in repeater Asp.net

  27. 27

    asp net dropdown selectedvalue/selectedindex not updating in repeater

  28. 28

    ASP.Net - Issues with Repeater / DataBinding

  29. 29

    Repeater in asp.net from DB with DropDownList

HotTag

Archive