Accessing server-side Datatable object from client-side javascript?

I am working on a control  that generates 2D charts (line,bar,pie,etc) using VML (for now) to draw the charts client-side. I am new to Javascript and still cant figure out how to access the data I need to graph from the javascript side.  I am currently using a Sys.Data.Datable on the client side as test data (building the table manually in javascript) and it works fine but I cannot figure how to pass a datatable from the server to the control extension behavior?

I have read/seen code on the forums on how to do this using a web-service but I am really looking at a more generic approach where people could just bind a datatable to the control via the properties or in code so they can use their business logic layer functionality without having to write web-services.

Let's say I have the name of the page object/variable holding the datatable (from properties of control) how would I access this object as a Sys.Data.Datatable in Javascript? Would I need to use some kind of converter?

(hope I explained myself correctly and  this makes sense to someone hehe)

 

Thanks in Advance

Pascal

0
VFPDucky
6/1/2006 1:31:10 PM
asp.net.ajax_control_toolkit 17816 articles. 1 followers. Follow

2 Replies
1863 Views

Similar Articles

[PageSpeed] 23

Hello Pascal:

> I am new to Javascript and still cant figure out how to access the data I need to graph from the javascript side.

Strictly speaking, you can't! It is the server-side code that renders client-side code, so what you can do is actually the reverse: write the datatable to javascript.

Here is a topic that can give some hints: http://forums.asp.net/thread/1285185.aspx

This said, please feel free to go deeper with your question if needed.

-LV


Julio P. Di Egidio
Software Analyst Programmer
=BUSINESS AND SCIENTIFIC=
=SOFTWARE DEVELOPMENT=
http://julio.diegidio.name

(Peace X Love] = [++1)
0
LudovicoVan
6/1/2006 1:58:45 PM

Thanks for the quick reply btw :)

Here is some example of what I am trying to do (not actual code):

Lets say I have some ASPX page code like...

 

 

 
<script language="VB">

   Private sub Page_Load()
        
      dim myTable as System.Data.Datatable
      ... populate table ...
   End sub
</script>

<html>
  <body>
    <atlas:ScriptManager runat="server" ID="PageScriptManager" EnablePartialRendering="True">
    </atlas:ScriptManager> 
     <asp:Panel ID="ChartPanel" runat="server" Height="300" Width="400" />
      <cc1:ChartPanelExtender ID="ChartPanelExtender1" runat="server" >
          <cc1:ChartPanelProperties ChartTitle="This is my Graph!" TargetControlID="ChartPanel" ChartType="0" ChartHeight="100" ChartWidth="300" ChartBackColor="#FF3A00" ChartTitleFontFamily="Arial Black" ChartTitleFontSize="20" ChartTitleFontWeight="Normal" ChartTitleTextAlign="Right" />
      </cc1:ChartPanelExtender>
  </body>
</html>

 The ChartPanelExtender is an atlas control extender that has its functionality (chart graphing) in its ChartPanelBehavior.js javascript file. What I would like to do is access that myTable from inside the javascript behavior file? Is that possible?

 

Thanks in advance,

Pascal

0
VFPDucky
6/1/2006 2:32:27 PM
Reply:

Similar Artilces:

Instantiating an object of a server-side class in client-side JavaScript
Sorry this might be an easy question, but I couldn't find how to do this.I want to define an object like,var myObj = new MyServerSideClass(); MyServerSideClass is defined in the cs code. Is this possible? If it is, how? Thanks in advance.  Checkout the Example of Passing and Returing Complex Types in this doc:http://www.asp.net/AJAX/Documentation/Live/tutorials/ConsumingWebServicesWithAJAXTutorial.aspxLong Live .NETKazi Manzur Rashid (Amit)_________________________Web: http //dotnetshoutout.comBlog: http://weblogs.asp.net/rashidTwitter: http://twitter.com/manzurrashid...

Problem accessing a server side declared array from the client side javascript function.
I have an array that store the values of a resultset row under the server side coding.How do i retrieve them under my client side javascript function.I wrote the following coding under my client side function and it got an error.BSCStr is an array storing data from a resultset row which i did under the server side coding. From client side javascript function: addr=addr + "&C" + i + "=" + <%=BSCStr[i]%>; Hi wingshya, Did you still need help with this thread? Jason ConwayMCP, MCTS, Certified SCRUM Masterasp.net blog...

Problem accessing server side array values from client side javascript function
i faced the following problem ..i have an array that store the values of a resultset row under the server side coding.How do i retrieve them under my client side javascript function.I wrote the following coding under my client side function and it got an error.BSCStr is an array storing data from a resultset row which i did under the server side coding. From client side function: addr=addr + "&C" + i + "=" + <%=BSCStr[i]%>;...

Accessing server-side control in client-side javascript function; on Content page
I am trying to set an asp:textbox value in the Client side javascript function. It works fine on the standalone page. But when i try to do this the Content page, it’s giving the follwoing error message. document.getElementByID[...] is null of not an object  Any idea? Thanks, Riz   Hi, are you using ClientID property of that server control, to get its ID (which is rendered at the client and can be used with document.getElementById )?Thanks,Teemu KeiskiFinland, EU Thank you my problem is solved....

Problem accessing server side array values from javascript client side function
i faced the following problem ..i have an array that store the values of a resultset row under the server side coding.How do i retrieve them under my client side javascript function.I wrote the following coding under my client side function and it got an error.BSCStr is an array storing data from a resultset row which i did under the server side coding. From client side function: addr=addr + "&C" + i + "=" + <%=BSCStr[i]%>; First of all, you can't mix server-side and client-side code. The reason is that the protocol that is used to communicate betwee...

server side variables in client side javascript
I want to use an ASP.net variable in client side javascript.In regular asp I used hidden fields.what is the best way to do this in ASP.NET ?thx,Intersee my blog at www.Interdevelopments.com and check the future of open mobile widget solutions at www.glowe.org By and large, I personally still use Hidden fields to store information, that either my Javascript function or my code-behind use.  I barely use the RegisterScriptBlock method(s) and that is only for situations where I want to be really dynamic with the client side functionality.  95% of the time, I can still use a...

Firing both Client side event and server side event for server side button
I am having some difficulties getting this to work.. I have button_click (Asp.net) and ClientClick (Javascript).  Javascript is firing fine.  Server script is not. may be you have return return false in the in the javascript which is why its not firing server side event.You should add javascript evelt like thisbutton1.onclientclick = "functionname" Function should nopt return false. Vikram www.vikramlakhotia.comPlease mark the answer if it helped you...

Client side code accessing server side variables
I am attempting to send a variable value from C# to the page for Javascript to access and use.  Basically I am using a prompt window in my server side javascript to capture a value and update the database with it.  If the value entered is not unique (because this is a unique identifier) I return a value indicating this.  I want this value available to my javascript code so I can provide an alert message telling the user to try again with a unique value.  If there is a way to make the message come right from my C# code behind page that will work for me too. Thanks ...

Accessing Client side variable from server side code?
Hi,  I am trying to use vbscript to run a process on the client machine. Once that process finishes I want to use the resulting value in my server side code behind file. Does anyone know a way to do this? I know that I can set server side session objects to a client variable by doing something like this: <script language="vbscript" type="text/vbscript">  strSubject = <%=Session.Item("Subject") %> </script>  but I have no idea how to do that in reverse. Thanks!    Filed under: too much coffee.  LOL! ...

Accessing Client side variable on Server side (PostBack)
New to ASP.NET. Can anyone tell me how to access client side variable on server side ie. while postback thanks, The best way to access arbitrary clientside values from the serverside is to store the values in a hidden input instead of a variable. How to access the client side variable from the server side variable in case of the htc file. You can use hidden variables. Here's an excellent post that will guide you in the right direction : http://dotnetsavvyblog.blogspot.com/2007/11/how-to-access-client-side-control-in.html Hi...The Client side variable's value can be&nb...

Jscript, moving from client-side to server-side (.NET)
Hey all I’m working translating a web-app written in client-side Jscript to run on the server-side as JScript.NET. Without needing to get too specific, I am using Jscript because the original page aggregated raw data to produce statistical results (this was done dynamically based on user 'sort-by' options). The final output is an html report that can be emailed. Because this is currently being done on the client side, as the raw data grows the load-time grows as well (to the point that has almost become unusable). I’m posting here to see if anyone has any experi...

How to call server side function from client side JavaScript?
I want to call a server-side function, like a button's click event or just another private or public function , from a client-side JavaScript function. How do I do that? thanX AnzIf this post was useful to you, please mark it as answer.ClientSideAsp.Net | Blog Maybe alittle more that you need, but....... 1) Put a button on the page. Lets say its id is Button1. Make sure that its has causesValidation=false 2) Write the code for the button. 3) Write the following in the PAge_Load event Button1.Attributes.Add("onClick", "myJSFunction(); return false") 4) Copy this javascript...

Accessing server-side variables from client-side events
This is a multi-part message in MIME format. ------=_NextPart_000_00E8_01C04D70.7EAC7080 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable In a client-side itemchanged function, how can I set a server-side = variable?? I simply need to execute the following: psSession.SetValue("userID", user_id); I'm sure there's a way to trigger server-side script and pass in = variables. Any suggestions?? Thanks. ------=_NextPart_000_00E8_01C04D70.7EAC7080 Content-Type: text/html; charset="iso-8859-1" ...

how to call server side function from client side javascript?
Hi all, I have a image button in the update panel. I would like to call a method from server side (not from webservice) to get the variable when Onclick on the image button is invoked. Is there any way that I can able to access this function from the client script? In using the UpdatePanel, in essence, you're already doing this because there will not be a full postback.  You can make an asynchronous call to your Click method of your ImageButton.  So, what do you want to do with this "variable"?Christopher Reed"The oxen are slow, but the earth is patient."...

Web resources about - Accessing server-side Datatable object from client-side javascript? - asp.net.ajax_control_toolkit

Server Side Includes - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Google Cloud Platform simplifies server-side development for iOS w/ ‘Mobile Backend Starter’
... Mobile Backend Starter that first debuted for Android developers back in June. Google says the application helps to simplify the server-side ...

Free Cooling: the Server Side of the Story
Servers that support higher inlet temperatures could significantly reduce or even eliminate the cooling costs of the data center. We received ...


[Update: Check Now] Play Store For Android Gets Search Bar With Hamburger Flip In Server-Side Update
Google is pushing out an update to the Play Store's Android interface that replaces the action bar with a standard search bar. Inside are the ...

Server-side update makes Siri a stickler for succinctness
Siri is already well known for her wit and willingness to joke, but a recent server-side update has given Apple's digital assistant the ability ...

Japanese RIAA wants server-side music DRM for mobile phones
The Recording Industry Association of Japan—the Japanese version of the RIAA— …

New BaaS platform aims to eliminate writing server-side code
... offering for desktop and mobile developers that's now leaving its beta phase. By removing the need for writing code on the server-side, Backendless ...

Dart improves async and server-side performance
... Team Today's release of the Dart SDK version 1.3 includes a 2x performance improvement for asynchronous Dart code combined with server-side ...

Customize Google Using Server-Side Scripts
Google's services have a lot of powerful features, but they can't offer all the options requested by users. A popular way to customize Google ...

Resources last updated: 1/16/2016 7:46:55 AM