Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Is there a way javascript access DataTable?

Is there a way javascript access DataTable?

Scheduled Pinned Locked Moved ASP.NET
javascriptquestion
9 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    Old Gun
    wrote on last edited by
    #1

    I want use javascript control excel to print report at client,The Datasource is Datatable,I don't know how javascript access DataTable data. Please give some tips,Thank you.

    Z M 2 Replies Last reply
    0
    • O Old Gun

      I want use javascript control excel to print report at client,The Datasource is Datatable,I don't know how javascript access DataTable data. Please give some tips,Thank you.

      Z Offline
      Z Offline
      zrocb81
      wrote on last edited by
      #2

      I encounter similar problem before. In my case, i used server scripting to generate the client javascript. as below... ////////////////////////////////////////////////////// DataTable DataTable1 = ....... //code your create virtual table using server scripting here Response.Write (""); foreach(DataRow DRow in DataTable1.Rows) { Response.Write ("alert('" + DRow["YourDataFieldName"].ToString() + "')"); } Response.Write ("<_ " + "script>"); <----- server error reading my typed '/' here -- modified at 5:04 Monday 2nd January, 2006

      O 1 Reply Last reply
      0
      • Z zrocb81

        I encounter similar problem before. In my case, i used server scripting to generate the client javascript. as below... ////////////////////////////////////////////////////// DataTable DataTable1 = ....... //code your create virtual table using server scripting here Response.Write (""); foreach(DataRow DRow in DataTable1.Rows) { Response.Write ("alert('" + DRow["YourDataFieldName"].ToString() + "')"); } Response.Write ("<_ " + "script>"); <----- server error reading my typed '/' here -- modified at 5:04 Monday 2nd January, 2006

        O Offline
        O Offline
        Old Gun
        wrote on last edited by
        #3

        Hi zrocb81,Thank you for your help. Because I have to format excel report,so I want to use javascript access DataTable,not at server side.

        Z I 2 Replies Last reply
        0
        • O Old Gun

          Hi zrocb81,Thank you for your help. Because I have to format excel report,so I want to use javascript access DataTable,not at server side.

          Z Offline
          Z Offline
          zrocb81
          wrote on last edited by
          #4

          i'm not sure with the javascript format excel report. But as i know, there is no way for javascript--CLIENT scripting to access directly to DataTable in SERVER scripting. Unless you use server scripting to generate the client script, or else it's impossible for javascript read data directly from server side DataTable.

          1 Reply Last reply
          0
          • O Old Gun

            Hi zrocb81,Thank you for your help. Because I have to format excel report,so I want to use javascript access DataTable,not at server side.

            I Offline
            I Offline
            Ista
            wrote on last edited by
            #5

            Javascript is client side so the answer is no, javascript cant because a DataTable is server side. You could put all the data in a hidden field but that would be ugly 1 line of code equals many bugs. So don't write any!!

            1 Reply Last reply
            0
            • O Old Gun

              I want use javascript control excel to print report at client,The Datasource is Datatable,I don't know how javascript access DataTable data. Please give some tips,Thank you.

              M Offline
              M Offline
              mikailcetinkaya
              wrote on last edited by
              #6

              you can only access that data through an Ajax call. For client javascript pls refer: At Server u should have a page that directly outputs xml from database. Take response.Stream to datatable ' xmlwriter to give direct xml Mikail Çetinkaya . The C# DEveloper

              O 1 Reply Last reply
              0
              • M mikailcetinkaya

                you can only access that data through an Ajax call. For client javascript pls refer: At Server u should have a page that directly outputs xml from database. Take response.Stream to datatable ' xmlwriter to give direct xml Mikail Çetinkaya . The C# DEveloper

                O Offline
                O Offline
                Old Gun
                wrote on last edited by
                #7

                Thank you for your answer! I never heard 'Ajax call',Could you give me more tips? I think this is good way.

                M 1 Reply Last reply
                0
                • O Old Gun

                  Thank you for your answer! I never heard 'Ajax call',Could you give me more tips? I think this is good way.

                  M Offline
                  M Offline
                  mikailcetinkaya
                  wrote on last edited by
                  #8

                  ajax is all about producing & consuming data through Xml and asynchronous javascript calls look at ajax professional lib(microsoft implementation of it) on msdn.microsoft.com Mikail Çetinkaya . The C# DEveloper

                  O 1 Reply Last reply
                  0
                  • M mikailcetinkaya

                    ajax is all about producing & consuming data through Xml and asynchronous javascript calls look at ajax professional lib(microsoft implementation of it) on msdn.microsoft.com Mikail Çetinkaya . The C# DEveloper

                    O Offline
                    O Offline
                    Old Gun
                    wrote on last edited by
                    #9

                    Thank you very much,By your help,I found it here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/ASPNetSpicedAjax.asp[^] Thank you again!

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups