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

The Archive Base Latest Questions

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

I understand there are MANY posts on this, but I have tried every single

  • 0

I understand there are MANY posts on this, but I have tried every single one and none of them work!

I have an aspx and aspx.cs page being run using visual studio 2010.

on my aspx page I have a table

<table id="viewPendingTable" runat="server"></table>

On the aspx.cs page, the table is loaded with data. This works fine, No Problem. Once the page is loaded, the table contains the dynamically added data I require.

I am using jquery dataTables to style my table using the standard

$(document).ready(function () {
    $('#viewPendingTable').dataTable({
        "bJQueryUI": true,
    });
});

When I create a test table with dummy information directly into the html, the data table displays correctly as required. But when I apply The jquery script to the dynamic table. Nothing happens. The dynamic data is displayed as required, but the data table (search functions, style etc) are not present.

Now I suspect this is because the scripts are run before the table is populated with data.

This is where I began my mission to force the jquery/javascript to run AFTER the aspx.cs has run and the table has been populated.

But I failed… So just as a test I thought I’d run an alert(‘YAAY’); from the c# side using registered start up scripts. but to no Avail that wouldnt work.

So can somebody PLEASE tell me why this isn’t working.

I’ve tried Multiple Different ways of startup scripts!

My aspx is:

<table id="viewPendingTable" runat="server"></table>

<script type="text/javascript" language="javascript" id="ShowTable">
<!--
    loadTable();
    function loadTable() {
        $(document).ready(function () {
            $('#viewPendingTable').dataTable({
                "bJQueryUI": true,
                "sPaginationType": "full_numbers"
            });
        });
        alert('ALEX');
        document.getElementById("table_id").width = "100%";
    }
//-->
</script>

And my aspx.cs is:

protected void Page_Load(object sender, EventArgs e)
{
    loadMyTable();
    ClientScriptManager a = null;
    a.RegisterStartupScript(GetType(), "anotherkey", "alert('ASDFASDFASDF');", true);
    a.RegisterStartupScript(GetType(), "anfgsdgsderkey", "alert('MOTHER');", false);
    a.RegisterStartupScript(this.GetType(), "AKey", "loadTable();", true);

    ClientScript.RegisterStartupScript(GetType(), "MyScript", "<script language=javascript>" + "alert('Hello ASP.NET'); }</script>");

    ScriptManager.RegisterStartupScript(this.Page, GetType(), "script", "alert('Success!');", true);

    Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "alert('AAA');", true);

    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "script",
        "alert('a');" +
        "$(document).ready(function (){" +
            "$('#viewPendingTable').dataTable({" +
                "\"bJQueryUI\": true" +
                "\"sPaginationType\": \"full_numbers\"" +
            "});" +
        "}); alert('b'); document.getElementById('viewPendingTable').width = 100%", true);

}

I have tried more methods for trying to run javascript after page load but they were lost in the anger of failing so badly.

Somebody PLEASE HELP!

Why aren’t my simple javascript alerts running?

Even if I got them to work… would the data table be correctly styled by executing the jquery after page Load???

Thankyou Kindly for your time

Alex

p.s. No comments on asp:gridView or asp:DataTable as That Failed EPICALLY and i posted a question on it days ago and nobody has replied. If you care to take a look
CLICK HERE

  • 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-23T19:08:28+00:00Added an answer on May 23, 2026 at 7:08 pm

    Change this line of code and try

    "$('# " +   viewPendingTable.ClientID + "').dataTable({" +
    

    in you document.read script that you have written

    Its because you can get acutal ID of the table control when the page get render on the browser

    Edit
    Make use of

    RegisterStartupScript because it emits your JavaScript at the end of the page just before </form> tag (before the <form> tag ends).

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

Sidebar

Related Questions

I appreciate there are many posts on this, and much on google, but I'm
Why only one overload throws this exception? Little update: I understand that there was
I've seen some similar posts, but nothing quite like this... I have a website
Edit Since there were many downvotes and people who didn't understand what I'm asking
This question is for the java language in particular. I understand that there is
is there any way to make IE6 understand double classes, say I have a
I know this is the repeat question.There are many similar questions are there in
I've seen this behaviour in many websites and web applications but I'm not able
I've read so many posts and still can't find or understand how to handle
I started learning functional programming (OCaml), but I don't understand one important topic about

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.