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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:13:55+00:00 2026-05-13T12:13:55+00:00

I am currently implementing a client-side paging solution using ASP.NET, jQuery and JSON. I

  • 0

I am currently implementing a client-side paging solution using ASP.NET, jQuery and JSON.

I have been following the excellent article from encosia: http://encosia.com/2008/08/20/easily-build-powerful-client-side-ajax-paging-using-jquery/

In my Web Method I retrieve my data from the database as a DataTable:

    DataTable categoryProducts = ProductViewerAccess.GetCategoryProducts
        ("AA", 4, 0, Page.ToString(), out howManyPages, "FALSE", 0, "CostPrice", "asc", destinationList);

I then retrieve the data from the DataTable into an anonymous type:

    var feeds =
        from feed in categoryProducts.AsEnumerable()
        select new
        {
            Description = feed.Field<string>("description"),
            MfPartNo = feed.Field<string>("MfPN"),
            Inventory = feed.Field<Int32>("Inventory")
        };

The anonymous type is then returned from the Web Method to the client-side:

return feeds.Take(PageSize);

A template then extracts and displays the fields:

  <tbody>
    {#foreach $T.d as post}
    <tr>
      <td>
        {$T.post.Description}
        <p>Mfr#: {$T.post.MfPartNo}</p>
      </td>
      <td>{$T.post.Inventory}</td>
    </tr>
    {#/for}
  </tbody>

This all works great.

However, I would like to extend the code to perform some evaluation checks (e.g., check that various columns in the DataTable are not NULL) and other pre-processing (e.g., call various functions to build the image URL based on the image ID – which is another column in the DataTable not shown in the code fragment) before I return the resulting rows of the DataTable as an anonymous type to the client-side.

Basically, I want to iterate through the DataTable, perform the evaluation checks and pre-processing, while building my anonymous type manually as I go. Or maybe there is a better way to achieve this?

Is there anyway I can achieve this?

Kind Regards

Walter

  • 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-13T12:13:56+00:00Added an answer on May 13, 2026 at 12:13 pm

    I think that checking for nulls is probably something that makes sense on the server-side. The approach that Douglas describes is one workable one. Another is to handle the null issue as you’re building the collection of anonymous types:

    var feeds =
        from feed in categoryProducts.AsEnumerable()
        select new
        {
            Description = feed.Field<string>("description"),
            MfPartNo = feed.Field<string>("MfPN"),
            // Return 0 if the inventory value is null.
            Inventory = (int?)feed.Field("Inventory") ?? 0
        };
    

    ScottGu has a good post on using the null coalescing operator to handle nulls concisely, as shown above.

    As for building the links, that’s something I would probably suggest doing in the client-side template. You can eliminate quite a bit of redundant data sent in the JSON that way. Something like this, for example:

    <tbody>
      {#foreach $T.d as post}
      <tr>
        <td>
          <a href="/url/to/details.aspx?id={$T.post.ID}">{$T.post.Description}</a>
          <p>Mfr#: {$T.post.MfPartNo}</p>
        </td>
        <td>{$T.post.Inventory}</td>
      </tr>
      {#/for}
    </tbody>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 523k
  • Answers 523k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can look at this method: - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath… May 16, 2026 at 9:39 pm
  • Editorial Team
    Editorial Team added an answer Running your full example as you provided Fast time: 00:00:01.6187793… May 16, 2026 at 9:39 pm
  • Editorial Team
    Editorial Team added an answer For sharing complex persistent user-defined objects, the following approaches are… May 16, 2026 at 9:39 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I'm currently implementing a Silverlight application using WCF for the communication between client and
I am implementing a RESTful web service that currently handles JSON and needs to
I am currently implementing a YUI datatable as a reusable viewer to show sales
I'm implementing an application that will have a lot of clients querying lots of
Currently implementing vectorial interface elements on iOS is very peculiar, UIImage advertises support only
I'm currently working on implementing the public API of our web application. The application
Hey, I'm currently looking for various methods of implementing collision response in 2D video
I am currently developing a dynamic LineChart in FLEX 4. I am implementing a
Currently I have my VaryByCustom functionality implemented in classes that implement an interface IOutputCacheVaryByCustom
[Update]: Forgot to include ComponentArt... Hi, An interaction designer employed by the client I

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.