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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:24:20+00:00 2026-06-07T13:24:20+00:00

This seems simple but I just cannot get it. I have an asp.net page,

  • 0

This seems simple but I just cannot get it.
I have an asp.net page, with the following credentials:

  1. 1 button
  2. 1 textbox
  3. 1 repeater

*Now when I type a text in my textbox, I passed the text to a web method using jquery ajax,
which inserted the text into the database.
Now I have a public method in my code behind thta selects the data from the database and bind it to a repeater.
How do I display this this repeater on every data insert without a postback?
*

 success: function (data) {
            for (var i = 0; i < data.d.length; i++) {
                $("#tbDetails").append("<tr><td>" + data.d[i].ID + "</td><td>" + data.d[i].ChargeName + "</td><td>" + data.d[i].Description + "</td></tr>");
            }
        },
        error: function (result) {
            alert("Error");
  • 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-07T13:24:22+00:00Added an answer on June 7, 2026 at 1:24 pm

    This is a little sample, I guess you can ignore the Insert part since you said you already have it. This uses jQuery, which you also are using.

    HTML:

    <%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="false"
            CodeFile="Default.aspx.cs" Inherits="_Default" %>
    
        <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
            <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
            <script language="javascript" type="text/javascript">
                function insertData() {
                    $.ajax({
                        type: "POST",
                        contentType: "application/json; charset=utf-8",
                        url: "Default.aspx/insertData",
                        data: "{}",
                        dataType: "json",
                        success: function (data) {
                            if (data.d != null)
                                alert(data.d);
                        }
                    });
                }
    
                function retrieveData() {
                    $.ajax({
                        type: "POST",
                        contentType: "application/json; charset=utf-8",
                        url: "Default.aspx/retrieveData",
                        data: "{}",
                        dataType: "json",
                        success: function (data) {
                            if (data.d != null) {
                                for (i = 0; i < data.d.length; i++) {
                                    $("#myTable").append("<tr><td><input type='button' onclick='deleteRow(" + data.d[i].ID + ")' value='Delete'></input></td><td>" + data.d[i].Name + "</td><td>" + data.d[i].LastName + "</td><td>" + data.d[i].Age + "</td></tr>");
                                }
                            }
                        }
                    });
                }
                function deleteRow(ID) {
                    $.ajax({
                        type: "POST",
                        contentType: "application/json; charset=utf-8",
                        url: "Default.aspx/deleteRow",
                        data: "{'row':'" + ID + "'}",
                        dataType: "json",
                        success: function (data) {
                            if (data.d != null) {
                                alert(data.d);
                            }
                        }
                    });
                }
                retrieveData();
            </script>
        </asp:Content>
        <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
            <table id="myTable">
            </table>
        </asp:Content>
    

    ASP.NET:

    using System;
    using System.Web.Services;
    using System.Collections.Generic;
    
    public partial class _Default : System.Web.UI.Page
    {
    
        [WebMethod]
        public static List<SampleClass> retrieveData()
        {
            //Retrieve data from the server and return.
            List<SampleClass> tmp = new List<SampleClass>();
    
            tmp.Add(new SampleClass() { Name = "Test", LastName = "Number 1", Age = 44, ID = 1 });
            tmp.Add(new SampleClass() { Name = "Test", LastName = "Number 2", Age = 23, ID = 2 });
            tmp.Add(new SampleClass() { Name = "Test", LastName = "Number 3", Age = 20, ID = 3 });
            tmp.Add(new SampleClass() { Name = "Test", LastName = "Number 4", Age = 45, ID = 4 });
            tmp.Add(new SampleClass() { Name = "Test", LastName = "Number 5", Age = 21, ID = 5 });
    
            return tmp;
        }
    
        [WebMethod]
        public static bool deleteRow(int row)
         {
            if (row > 0)
                return true;
    
            return false;
        }
    
        [WebMethod]
        public static bool insertData()
        {
            //Do all of the insert in the server blah blah blah
            //and return true or false if it was inserted.
            return true;
    
        }
    }
    
    public class SampleClass
    {
        public int ID { get; set; }
        public string Name { get; set; }
        public string LastName { get; set; }
        public int Age { get; set; }
    }
    

    Good luck!
    Edit: Now you can also see a delete sample, which includes passing an argument to the webmethod. Good luck.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This seems simple but I've exhausted my Google search patience. I have a RelativeLayout
This seems like it should be very simple but I can't get it to
This seems like such a simple issue but I cannot find an elegant solution.
I am sure this is quite simple but I cannot seem to get this
This seems like the most common relationship but for some reason I cannot get
Im sure this is pretty simple but I just cant seem to find the
This is probably something really simple but for some reason I just can't seem
This must be very simple. But I just can't seem to find the proper
This should be a simple question, but I just can't seem to figure it
This seems simple but I can't figure it out. I receive post data 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.