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 6200233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:19:48+00:00 2026-05-24T04:19:48+00:00

I have a Linkbutton inside a repeater and I want to delete the Item

  • 0

I have a Linkbutton inside a repeater and I want to delete the Item when the user clicks on the Linkbutton; in this case the LinkButton’s ItemCommand event is not fired, my code is below:

<asp:Repeater ID="rptSubject" runat="server" OnItemCommand="rptSubject_OnItemCommand">
        <ItemTemplate>
          <tr>
           <td><asp:CheckBox id="chkAll" runat="server"/></td>
            <td><%#Eval("SubjectName") %></td>
            <td> 
                <asp:ImageButton ID="imgbtnDelete" ImageUrl="~/assets/images/icons/delete.png" runat="server" CommandName="Delete" CommandArgument='<%#Eval("SubjectID") %>'/>
               <asp:LinkButton ID="lnkEditCategory" runat="server" CommandName="EditCategory" CommandArgument='<%#Eval("SubjectID") %>' Text="Edit Category"></asp:LinkButton> 

             </td>
          </tr>
     </ItemTemplate>

my repeater’s itemcommand event handler is:

    protected void rptSubject_OnItemCommand(object source, RepeaterCommandEventArgs e)
{

    if (e.CommandName.Equals("Delete"))  
    {
        // some code
    }

    if (e.CommandName.Equals("EditCategory")) 
    {
   // some code
    }

}

when I click on the image button my item command event fires but when I click on the link button it doesn’t.

  • 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. Editorial Team
    Editorial Team
    2026-05-24T04:19:48+00:00Added an answer on May 24, 2026 at 4:19 am

    The following code works for me:

    <%@ Page Language="C#" %>
    <script type="text/c#" runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var data = new[]
                {
                    new 
                    {
                        SubjectID = "1",
                        SubjectName = "subject name 1" 
                    },
                    new 
                    {
                        SubjectID = "2",
                        SubjectName = "subject name 2" 
                    },
                };
                rptSubject.DataSource = data;
                rptSubject.DataBind();
            }
        }
    
        protected void RptSubject_OnItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName.Equals("Delete"))
            {
                // some code
            }
    
            if (e.CommandName.Equals("EditCategory"))
            {
                // some code
            }
        }    
    </script>
    <!DOCTYPE html>
    <html>
    <head>
        <title></title>
    </head>
    <body>
        <form id="Form1" runat="server">
            <asp:Repeater ID="rptSubject" runat="server" OnItemCommand="RptSubject_OnItemCommand">
                <ItemTemplate>
                    <div>
                        <asp:CheckBox id="chkAll" runat="server"/>
                        <%#Eval("SubjectName") %>
                        <asp:LinkButton ID="imgbtnDelete" runat="server" CommandName="Delete" CommandArgument='<%#Eval("SubjectID") %>' Text="Delete" />
                        <asp:LinkButton ID="lnkEditCategory" runat="server" CommandName="EditCategory" CommandArgument='<%#Eval("SubjectID") %>' Text="Edit" />
                    </div>
                </ItemTemplate>
            </asp:Repeater>
        </form>
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a linkbutton inside datalist1 item template field, i want when user click
I have a LinkButton inside an UpdatePanel that I do not want the client
I have a linkbutton in gridview and i want to click event on code
I have a user control with linkbuttons (used for paging) and a repeater inside
I have a datagrid with linkbutton inside it. <asp:DataGrid id=listDataGrid Runat=server> <Columns> <asp:TemplateColumn HeaderText=Item
I Have a LinkButton when clicked I want to preform an operation inside the
I have a Linkbutton inside a Repeater control. My code in the aspx page
i have Linkbutton inside updatePanel and when i click on it it returns following
In gridview's column i have a linkbutton and a label under it. I want
how can i use request.querystring in asp.net.i have a linkbutton and this is in

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.