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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:29:47+00:00 2026-06-09T08:29:47+00:00

I have Repeater control like this; <asp:Repeater ID=repeaterCategoryList runat=server onitemcommand=repeaterCategoryList_ItemCommand> <ItemTemplate> <td class=center> <asp:Button

  • 0

I have Repeater control like this;

<asp:Repeater ID="repeaterCategoryList" runat="server" 
                onitemcommand="repeaterCategoryList_ItemCommand">
                <ItemTemplate>
                        <td class="center">
                            <asp:Button ID="buttonDelete" runat="server" CssClass="btn btn-primary" CommandName="Delete" Text="Delete" 
                                CommandArgument='<%# Eval("CategoryId") %>'/>
                        </td>
                    </tr>
                </ItemTemplate>
            </asp:Repeater>

And my code behind page looks like this;

protected void repeaterCategoryList_ItemCommand(object source, RepeaterCommandEventArgs e)
{
    if (e.CommandName == "Delete")
    {
         //my server side logic here
    }
}

And my javascript code in .aspx file looks like this:

<script>
    $(function () {
        $('#buttonDelete').live('click', function (e) {
            e.preventDefault();
            $.alert({
                type: 'confirm'
                , title: 'Alert'
                , text: '<p>Are you sure, you want to delete this category</p>'
                , callback: function () {

                    // call server side here
                }
            });
        });

    });
</script>

How do I call the repeater delete command logic inside my javascrpt?
Is there any alternative way to do this?

  • 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-06-09T08:29:51+00:00Added an answer on June 9, 2026 at 8:29 am

    You can use ItemDatabound property of repeater to bind the Javascript function to Dalete Button Onclick event as follow…

    CodeBehind:-

     void Repeater1_ItemDataBound(Object Sender, RepeaterItemEventArgs e)  
     {     
       if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) 
          {
            int IdToBeDeleted=((Label)e.Item.FindControl("idFieldControl")).Text;     
            Button Btn= (Button)e.Item.FindControl("buttonDelete");     
            Btn.Attributes.Add("onclick","return ConfirmDelete('"+IdToBeDeleted+"')");    
          }
    
     } 
    

    Javascript:

    <script>  
      function ConfirmDelete(var idVal) 
      {    
         if(Confirm("Are you sure, you want to delete this category?")) 
          {
             var xmlhttp;
             if (window.XMLHttpRequest)
             {// code for IE7+, Firefox, Chrome, Opera, Safari
                 xmlhttp=new XMLHttpRequest();
             }
             else
             {// code for IE6, IE5
                 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
             }
    
    
             xmlhttp.onreadystatechange=function()
             {
                if (xmlhttp.readyState==4 && xmlhttp.status==200)
                   {
                     alert(xmlhttp.responseText);
                   }
             }
              xmlhttp.open("POST","DeletePage.aspx?id="+idVal,true);  
              xmlhttp.Send();
          }
      } 
    </script> 
    

    DeletePage.aspx:

    function pageLoad(sender, eventArgs) 
    { 
        if(!IsPostBack)
         {
           int IdToBeDeleted=Request.QueryString["id"];
           Write Your Delete Code Here...
           if delete successful...Response.Write("Delete Successful");
         }
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have Repeater Control and in that i have code like this <div runat=server
I have Repeater Control as shown below. <asp:Repeater ID=rptCategory runat=server> <HeaderTemplate> <h2 class=art-logo-text style=margin-bottom:
I have a Repeater control in my aspx page: <asp:Repeater ID=repeater runat=server EnableViewState=false> <ItemTemplate>
I have the following repeater code: <asp:Repeater ID=repMain runat=server OnItemCommand=repMain_ItemCommand EnableViewState=false> <ItemTemplate> <dmg:testcontrol runat=server
Greetings! I have a Repeater control that's using an XmlDataSource control. <asp:FormView id=myFormView runat=server
I have a asp.net repeater control in a aspx page, with runat=server and an
I have a repeater control: <table style=width: 100%> <asp:Repeater runat=server ID=rptOptions OnItemDataBound=rptOptions_ItemDataBound> <HeaderTemplate> <tr>
I have a repeater control with item template like this: <ItemTemplate> <table width=70%> <tr
I have a repeater that is looping a user control, like this: <asp:Repeater ID=repItems
I have an ascx that uses Eval in a repeater like this: <%@ Control

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.