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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T11:52:43+00:00 2026-06-16T11:52:43+00:00

On page load, I have my DataTable results available which I need to pass

  • 0

On page load, I have my DataTable results available which I need to pass back to the javascript for processing.

What are my options?

  1. Use a hidden field to pass the data back up. not sure how exactly, by maybe convert it to xml/json and then access it from javascript that way. Seems like a pain. No extra round trips for this approach.
  2. Use webmethod/webservice to issue a call directly from the javascipt and then get back the DataTable, however this requires an extra round trip since I already have the DataTable available on pageload.
  3. It is also possible to access objects in code behind using ASP.NET inline expressions (i.e. <% syntax) usable from the .aspx page. No extra round trips for this approach.
  4. Convert DataTable to json/xml and then use ASP’s ClientScript.RegisterStartupScript to make it available in there as a string returned from a function or something. Sounds hacky though.
  5. Bind the DataTable/DataSet (or any object that implements the IEnumerable interface) to an ASP data control such as a DataGrid, DataList, Repeater, etc… and then just hide the control via some CSS: #datacontrol {display: none;}

How can I 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-16T11:52:44+00:00Added an answer on June 16, 2026 at 11:52 am

    After trying several of the above options, I’ve found #3 (ASP.NET inline expressions) to be the best choice for accessing an ADO query result such as a DataTable or DataSet since it was the quickest to implement and had no additonal round trips due to the fact the inline expressions are resolved during the page construction.

    I tried #5 (bind data to data control, then hide it), but it was noticeably slower and I had problems finding a control that would expose all the features of a DataTable/DataSet. There are a handful of data controls that you can bind records to, but what I found was that much of the “nice-ities” that come with a DataSet/DataTable are lost when converting to a repeater control or such. If you use one of the more full featured ASP controls available to get more of those features back, you lose on performance since those controls are meant for read/write and to render the content for display. And it wasn’t as simple as I expected to access the data as it is in the code behind.

    I thought about #4 (passing data thru ASP’s ClientScript.RegisterStartupScript), but didn’t feel like serializing/deserializing every object I need to expose and working though any hiccups that come with it. It just didn’t seem like the right way. I suppose it would be fine for simpler objects though.

    And #1 (serialize data to a hidden field) is pretty much the same concept as the above #4 (passing data thru ASP’s ClientScript.RegisterStartupScript so I didn’t bother with that one either.

    The other (2nd best) possibility is to do #2 (using webmethod/webservice) as @Sundeep and @ron_tornambe have pointed out. However, this option adds an extra round trip to the page request and since the above scenario has the DataTable/DataSet ready for consumption on page load it is not optimal for me. If it wasn’t for that I’d say it was equal to my first choice of #3 (ASP.NET inline expressions) since you’ll get the full featured object to work with.

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

Sidebar

Related Questions

I have a situation where I need to ignore parts of page load sub
I have a grid table, which I do data binding on page load if
I'm using ICEFaces. I have datatable with multiple columns. One I load the page
I have a form which contains a checkbox field. On page load I want
I have a select dropdownlist with 1 item selected at page load in html.
Is there a way to have lightbox on page load?? Say like when the
i have many events such as $('.hidefile').click(function (event) { On page load and on
I have following code in page load Protected Sub Page_Load(ByVal sender As Object, ByVal
I already have the datatable. I just need to fill it in the list
Our page has a datatable which shows records from a web service. The web

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.