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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:41:34+00:00 2026-05-17T20:41:34+00:00

I am using ASP.NET MVC 2. I have played around you the YUI samples

  • 0

I am using ASP.NET MVC 2. I have played around you the YUI samples that can be found on http://developer.yahoo.com/yui/2/. I have been wondering if any one has had the time to use the YUI controls in an MVC app?

I want to start using the datatable and display my results from a SQL Server in this datatable. How is this possible? Any samples would be appreciated.

Thanks

  • 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-17T20:41:34+00:00Added an answer on May 17, 2026 at 8:41 pm

    The YUI controls are plain javascript controls and are server agnostic meaning that they can be used with any server side technology as long as you format the results as expected. So here’s an oversimplified example of the data table control in action using AJAX and JSON to populate its data:

    Controller:

    [HandleError]
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            return View();
        }
    
        public ActionResult Assets()
        {
            // TODO: fetch data from SQL using a repository
            var data = new
            {
                ResultSet = Enumerable.Range(1, 25).Select(i => new
                {
                    Title = "title " + i,
                    Phone = "phone " + i,
                    City = "city " + i
                })
            };
            return Json(data, JsonRequestBehavior.AllowGet);
        }
    }
    

    and in the view:

    <script type="text/javascript" src="http://yui.yahooapis.com/2.8.1/build/yuiloader/yuiloader-min.js"></script>
    <script type="text/javascript" src="http://yui.yahooapis.com/2.8.1/build/event/event-min.js"></script> 
    <script type="text/javascript" src="http://yui.yahooapis.com/2.8.1/build/connection/connection-min.js"></script>
    <script type="text/javascript" src="http://yui.yahooapis.com/2.8.1/build/json/json-min.js"></script> 
    <script type="text/javascript" src="http://yui.yahooapis.com/2.8.1/build/dom/dom-min.js"></script> 
    <script type="text/javascript" src="http://yui.yahooapis.com/2.8.1/build/element/element-min.js"></script>
    <script type="text/javascript" src="http://yui.yahooapis.com/2.8.1/build/datasource/datasource-min.js"></script>
    <script type="text/javascript" src="http://yui.yahooapis.com/2.8.1/build/datatable/datatable-min.js"></script> 
    <script type="text/javascript" src="http://yui.yahooapis.com/2.8.1/build/button/button-min.js"></script> 
    <script type="text/javascript">
    YAHOO.util.Event.addListener(window, 'load', function () {
        YAHOO.example.XHR_JSON = new function () {
            var myColumnDefs = [
                { key: 'Title', label: 'Name', sortable: true },
                { key: 'Phone' },
                { key: 'City' },
            ];
    
            this.myDataSource = new YAHOO.util.DataSource('<%= Url.Action("assets") %>');
            this.myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
            this.myDataSource.responseSchema = {
                resultsList: 'ResultSet',
                fields: ['Title', 'Phone', 'City' ]
            };
    
            this.myDataTable = new YAHOO.widget.DataTable('json', myColumnDefs,
                this.myDataSource);
    
        };
    });
    </script>
    
    <div id="json"></div>
    

    The datatable control is very powerful and contains many customizations like paging, sorting, … The documentation is pretty extensive and is worth reading to see examples in action. Armed with FireBug you could look at the requests and response parameters being exchanged between the client and the server in order to replicate each example.

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

Sidebar

Related Questions

I'm using ASP.NET MVC 2 and have a login page that is secured via
Using ASP.NET MVC 2.0, I have an actionlink that is used for comments on
I am using asp.net MVC to develop an application that will have ajax interactions.
I'm using ASP.NET MVC RC2. I have a set of classes that were auto-generated
I am using ASP.NET MVC C# I have a jQuery call that deletes a
Using ASP.NET MVC & Spark, I have a view that is listing a number
I am using asp.net mvc. I have generated a view that retrieve all unapproved
I am using asp.net mvc and have a section where a user can upload
using ASP.NET MVC, I have a Model, to which I'm attaching attributes so that
I'm using ASP.NET MVC and I have a partial control that needs a particular

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.