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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:31:00+00:00 2026-05-27T19:31:00+00:00

I am adding rows to a dynamically created table through javascript and I wanted

  • 0

I am adding rows to a dynamically created table through javascript and I wanted to get its values on postback.

Here’s the table:

<table id="summ" width="350px" border="1" >

Javascript snippet to add rows:

 $('#summ > tbody:last').append('<tr><td><input type="button" id="delete" value="Delete"></td><td>' + sup + '</td><td>' + qty + '</td><td><input type="text"></td></tr>');

How do I get the values of the cells appended to the table after a button is clicked? “summ” is not recognized because if I put runat=server on the table tag, the Javascript doesn’t work.

  • 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-27T19:31:01+00:00Added an answer on May 27, 2026 at 7:31 pm

    You may define AJAX (WebMethod) method in code behind (add reference of System.Web.Services) and use $.ajax or $.post to request it. Have a look at code-snippet I’ve posted for your reference.

    Sample.aspx (Code inline)

    <%@ Page Language="C#" %>
    <%@ Import Namespace="System.Web.Services" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <script runat="server">
        [WebMethod]
        public static string SendData(string sup,string qty)
        {
            return "OK : " + sup + " " + qty;
        } 
    </script>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Sample Page</title>
        <script src="../script/jquery-1.7.1.min.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(function () {
                var sup1 = 10; 
                var qty1 = 20;
                $("#btn1").click(function () {
                    var arg = '{sup: ' + sup1 + ',qty:' + qty1 + '}';
                    $.ajax({
                        type: "POST",
                        url: "Sample.aspx/SendData",
                        data: arg,
                        dataType: "json",
                        contentType: "application/json; charset=utf-8",
                        success: function (msg) {
                            alert(msg.d);
                        },
                        error: function (msg) {
                            alert("Error: " + msg);
                        }
    
                    });
                });
            });
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
           <input type="button" id="btn1" value="Save" />
        </div>
        </form>
    </body>
    </html>
    

    If you want to use “runat” attribute then add an empty inside the and write ClientID attribute.

    <table  runat="server"  id="summ" width="350px" border="1" >
     <tbody>
       <tr></tr>
     </tbody>
    </table>
    

    jQuery code

    $("#<%=summ.ClientID%> > tbody:last").append('<tr><td><input type="button" id="delete" value="Delete"></td><td>' + sup1 + '</td><td>' + qty1 + '</td><td><input type="text"></td></tr>');
    

    OR

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

Sidebar

Related Questions

I was looking at adding rows dynamically to my HTML table using jQuery with
In my web application, I was dynamically adding/deleting rows from my HTML table using
I have a table in which I am adding some rows dynamically and in
I'm dynamically adding rows to a table using jQuery. The table is inside a
I'm dynamically adding rows to an NSTableView. When I issue [table reloadData] I can
I'm adding new rows to a table dynamically, with this code: tbody = document.getElementById('tbody');
I have a HTML table where I am dynamically adding and hiding rows and
I have a page that is creating dynamically created rows in a table with
I have a table called newDataTable where I am adding new rows dynamically with
I have a requirement adding/deleting table rows dynamically using jquery. I have a 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.