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

  • Home
  • SEARCH
  • 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 984681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:03:09+00:00 2026-05-16T05:03:09+00:00

I have a HTML table which I add items to from javascript on an

  • 0

I have a HTML table which I add items to from javascript on an ASP.NET callback when a button is clicked.

HTML:

<%@ Page Language="C#" CodeFile="Hello5.aspx.cs" Inherits="ClientCallback" %>
<html>
<head>
  <script>
    function AddResult()
    {
        GetResults("blah", "");
    }
    function UpdateTable(itemText)
    {
        var mytable = document.getElementById("mytable");
        var rowID = mytable.rows.length;
        var newrow = mytable.insertRow(rowID);
        newrow.insertCell(0).appendChild(document.createTextNode(rowID));
        newrow.insertCell(1).appendChild(document.createTextNode(itemText));
    }
  </script>
</head>
<body>
    <form id="form1" runat="server" />
    <input type="button" onclick="AddResult()" value="Add Result" />
    <table border="1" id="mytable">
        <th colspan="2">Results</th>
    </table>
</body>
</html>

Codebehind:

public partial class ClientCallback : System.Web.UI.Page, System.Web.UI.ICallbackEventHandler
{
    string _inputVal;
    protected void Page_Load(object sender, EventArgs e)
    {
        string cbReference = Page.ClientScript.GetCallbackEventReference(this, "arg", "UpdateTable", "context");
        string callbackScript = "function GetResults(arg, context)" + "{ " + cbReference + "} ;";
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "GetResults", callbackScript, true);
    }
    void ICallbackEventHandler.RaiseCallbackEvent(string eventArgument)
    {
        _inputVal = eventArgument;
    }
    string ICallbackEventHandler.GetCallbackResult()
    {
        return _inputVal + " " + DateTime.Now.ToString();
    }
}

This callback system works fine but it’s not quite what I wanted.

I have a C# function to calculate a set of results based on a given input number. This can take a long time so I want to run it on a thread, and update the table whenever a new result is obtained.

But I can’t figure out how to call the javascript from my C# thread… any ideas?

  • 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-16T05:03:09+00:00Added an answer on May 16, 2026 at 5:03 am

    You can´t send a notificacion from the server to the client when the thread finishes. The only way is to make the client to request periodically the server (with ajax or refreshing the page) to check if the result of the thread is available.

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

Sidebar

Related Questions

I have a static Html Table which contains one button Add and when clicking
I have a html page which consist of a table & I want to
I have an HTML table, to which I would like to add or remove
I have a html table in which each line ( <tr> ) represents a
I have a simple HTML table which is bound using knockoutJS. However, I've added
I have a table in HTML which has three columns i.e Error - User
I am creating one form in html using table. Which have one Drop down
I have the following html structure (which is generated and I can't change): <table
I have the following code which creates a new table. var html = '<table>';
see fiddle i have html table and one textbox and one button.make cell selection

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.