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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:33:31+00:00 2026-06-12T06:33:31+00:00

I am trying to display a gridview in extjs. That data is collected from

  • 0

I am trying to display a gridview in extjs. That data is collected from sql db. I have a query to get the data from sql db in my GridViewController() but I am not sure on how to save those data in an array and then encode it as JSON and send the data back.

my gridviewcontroller

public string writeRecord()
    {

        Response.Write("Survey Completed!");
        SqlConnection conn = DBTools.GetDBConnection("ApplicationServices2");


        string sqlquery = "SELECT Q1, Q2, Q3, Q4, Improvements, Comments FROM myTable";
        SqlDataAdapter cmd = new SqlDataAdapter(sqlquery, conn);

        DataSet myData = new DataSet();
        cmd.Fill(myData, "myTable");

        JavaScriptSerializer jss = new JavaScriptSerializer();
        string json = jss.Serialize(myData);

        conn.Open();
        conn.Close();
        return "{rows: '+ json +'}";

    } 

and this is my gridviewApp.js. This is where I create the gridview and try to get the data back from my gridviewController.

var store = Ext.create('Ext.data.JsonStore', {


        storeId: 'myData',
        reader: new Ext.data.JsonReader({
            fields:[
            { name: 'Q1', type: 'int' },
            { name: 'Q2', type: 'int' },
            { name: 'Q3', type: 'int' },
            { name: 'Q4', type: 'int' },
            { name: 'Q5', type: 'int' },
            { name: 'Improvements', type: 'string' },
            { name: 'Comments', type: 'string'}]
            }),

            proxy: {
            type: 'json',
            url: 'GridView/writeRecord'
            }

    });  
    this.grid = Ext.create('Ext.grid.Panel', {
        title: 'GridView App',
        url: 'GridView/writeRecord',
        //store: store,
        store: Ext.data.StoreManager.lookup('myData'),
        columns: [
        {header: 'Q1', width: 100,
        sortable: true, dataIndex: 'Q1'},
        { header: 'Q2', width: 100,
            sortable: true, dataIndex: 'Q2'
        },
        { header: 'Q3', width: 100,
            sortable: true, dataIndex: 'Q3'
        },
        { header: 'Q4', width: 100,
            sortable: true, dataIndex: 'Q4'
        },
        { header: 'Improvements', width: 200,
            sortable: true, dataIndex: 'Improvements'
        },
        { header: 'Comments', width: 200,
            sortable: true, dataIndex: 'Comments'
        }
    ],
        stripeRows: true,
        //height:250,
        width: 800,
        renderTo: Ext.getBody()
    });

Any kind of suggestion or input will be highly appreciated… thanks

Update guys:

I get this error
A circular reference was detected while serializing an object of type ‘System.Globalization.CultureInfo’.

when I use

return Json(myData, JsonRequestBehavior.AllowGet);

But I am able to get result from my db when I use

myData.GetXml();

And here’s another tricky part.
I can only access my db result using direct path like

http://localhost:55099/GridView/writeRecord

but my gridView.js still shows blank… any insights?

  • 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-12T06:33:32+00:00Added an answer on June 12, 2026 at 6:33 am

    I’d use MVC’s built in Json functionality like this:

        public ActionResult ActionName()
        {
    
            DataSet ds = new DataSet();
    
            // populate ds
    
            return Json(ds, JsonRequestBehavior.AllowGet);
    
        }
    

    This will ensure your Json comes out in the right format.

    EDIT

    Your function would look like this:

        public ActionResult writeRecord()
        {
    
            Response.Write("Survey Completed!");
            SqlConnection conn = DBTools.GetDBConnection("ApplicationServices2");
    
    
            string sqlquery = "SELECT Q1, Q2, Q3, Q4, Improvements, Comments FROM myTable";
            SqlDataAdapter cmd = new SqlDataAdapter(sqlquery, conn);
    
            DataSet myData = new DataSet();
            cmd.Fill(myData, "myTable");
    
    
            conn.Open();
            conn.Close();
    
            return Json(myData, JsonRequestBehaviour.AllowGet);
    
        } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to display data that I am getting from server through json.
I am trying to display the data from sql into a datagrid as follows:
I have an js file that appends data from webmethod to a gridview. My
I'm trying to display some data from a Stored Procedure into my GridView .
I am trying to get a parameter for my update from the gridview but
I am trying to display data from XML using dataset in gridview. Now I
I am trying to display an image in a gridview, however, the columns that
I have an ASP Datalist with a nested GridView. I am trying to display
trying to display data only after variables have been set. $(document).ready(function () { function
I am trying to display the data using parametrized query try { SqlConnection xconn

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.