473,761 Members | 1,784 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

using C# class in jscript

Hello,

I have the following problem:
I have a web project where I display an activeX control that displays
2D-graphs on an aspx-page. I use jscript to access and modify the properties
of the activeX-2D-control. In
codebehind, I use C# for the application logic (eg. the database access).
The query to the database retuns me an object of a C# class (called
DBResultSet) that contains all the data from the query. This data has then to
be visualized on the 2d-graph activeX control on the .aspx-page
Here comes my question now:
How can I access the properties & methods of the class DBResultSet to assign
them to arrays and objects in jscript.
I know that the activeX control and jscript work on the clientside and the
application logic (written in C#) runs on the server. But the activeX control
can only be accessed on the clientside and I need the data from the database
to be displayed in the activeX-control.

I hope, somebody can help

thanks in advance

RFS666
Nov 19 '05 #1
4 1949
Two thing that comes to mind.

1) XmlHttp. Why not use Ajax to request the data in an Xml Format, which
your JScript can read and and set your 2d-graph appropriately.

2) Alternately, your C# code can write the JavaScript on page load and use
the Class DBResultSet while doing so

HTH

-G

"RFS666" <RF****@discuss ions.microsoft. com> wrote in message
news:CB******** *************** ***********@mic rosoft.com...
Hello,

I have the following problem:
I have a web project where I display an activeX control that displays
2D-graphs on an aspx-page. I use jscript to access and modify the
properties
of the activeX-2D-control. In
codebehind, I use C# for the application logic (eg. the database access).
The query to the database retuns me an object of a C# class (called
DBResultSet) that contains all the data from the query. This data has then
to
be visualized on the 2d-graph activeX control on the .aspx-page
Here comes my question now:
How can I access the properties & methods of the class DBResultSet to
assign
them to arrays and objects in jscript.
I know that the activeX control and jscript work on the clientside and the
application logic (written in C#) runs on the server. But the activeX
control
can only be accessed on the clientside and I need the data from the
database
to be displayed in the activeX-control.

I hope, somebody can help

thanks in advance

RFS666

Nov 19 '05 #2
Wow, thanks for the quick answer.

I decided to try alternative 2.
I create a string that contains the whole script code, beginning with
<script=jscript > and ending with </script>. Then I use the
registerClientS criptBlock method to inject the string containing the
scriptcode into the aspx-page.
But I don't know how to use the DBResult class in this script block.
The DBResult class contains a string array and an object array, these two
things have to be assigned to jscript string arrays and object arrays. My
problem is, I don't know how to make the cross-language assignment in the
scriptblock.
I tried like this:
string script = "<script language=jscrip t>";
script += "function useResult() {";
script += "var result : DBResult =
nameOfTheProtec tedVariableInCo deBehindOfTypDB Result"; // Error in this line
script += "}";
script +="</script>";
RegisterClientS criptBlock("scr iptBlock", script);

But this doesn't work.
Do I have to import something or so?

Thanks.

RFS666

"Grant Merwitz" wrote:
Two thing that comes to mind.

1) XmlHttp. Why not use Ajax to request the data in an Xml Format, which
your JScript can read and and set your 2d-graph appropriately.

2) Alternately, your C# code can write the JavaScript on page load and use
the Class DBResultSet while doing so

HTH

-G

"RFS666" <RF****@discuss ions.microsoft. com> wrote in message
news:CB******** *************** ***********@mic rosoft.com...
Hello,

I have the following problem:
I have a web project where I display an activeX control that displays
2D-graphs on an aspx-page. I use jscript to access and modify the
properties
of the activeX-2D-control. In
codebehind, I use C# for the application logic (eg. the database access).
The query to the database retuns me an object of a C# class (called
DBResultSet) that contains all the data from the query. This data has then
to
be visualized on the 2d-graph activeX control on the .aspx-page
Here comes my question now:
How can I access the properties & methods of the class DBResultSet to
assign
them to arrays and objects in jscript.
I know that the activeX control and jscript work on the clientside and the
application logic (written in C#) runs on the server. But the activeX
control
can only be accessed on the clientside and I need the data from the
database
to be displayed in the activeX-control.

I hope, somebody can help

thanks in advance

RFS666


Nov 19 '05 #3
You need to come out of your inverted comma's

Lets make a basic example.

Code Behind

private void Page_Load(objec t Sender, EventArgs e)
{
string str = "HELLO";
string MyScript = "";
MyScript = "<script language=jscrip t>";
MyScript += "alert(" + str + ");"; //Here i am coming out of the string
into the code
MyScript +="</script>";
RegisterClientS criptBlock("scr iptBlock", MyScript);
}

the effect.
A popup box that says hello :)

So when your setting your script, remember to come out of the inverted
comma;s to start using your c# variables or methids.

Hope thats clear enough
"RFS666" <RF****@discuss ions.microsoft. com> wrote in message
news:ED******** *************** ***********@mic rosoft.com...
Wow, thanks for the quick answer.

I decided to try alternative 2.
I create a string that contains the whole script code, beginning with
<script=jscript > and ending with </script>. Then I use the
registerClientS criptBlock method to inject the string containing the
scriptcode into the aspx-page.
But I don't know how to use the DBResult class in this script block.
The DBResult class contains a string array and an object array, these two
things have to be assigned to jscript string arrays and object arrays. My
problem is, I don't know how to make the cross-language assignment in the
scriptblock.
I tried like this:
string script = "<script language=jscrip t>";
script += "function useResult() {";
script += "var result : DBResult =
nameOfTheProtec tedVariableInCo deBehindOfTypDB Result"; // Error in this
line
script += "}";
script +="</script>";
RegisterClientS criptBlock("scr iptBlock", script);

But this doesn't work.
Do I have to import something or so?

Thanks.

RFS666

"Grant Merwitz" wrote:
Two thing that comes to mind.

1) XmlHttp. Why not use Ajax to request the data in an Xml Format, which
your JScript can read and and set your 2d-graph appropriately.

2) Alternately, your C# code can write the JavaScript on page load and
use
the Class DBResultSet while doing so

HTH

-G

"RFS666" <RF****@discuss ions.microsoft. com> wrote in message
news:CB******** *************** ***********@mic rosoft.com...
> Hello,
>
> I have the following problem:
> I have a web project where I display an activeX control that displays
> 2D-graphs on an aspx-page. I use jscript to access and modify the
> properties
> of the activeX-2D-control. In
> codebehind, I use C# for the application logic (eg. the database
> access).
> The query to the database retuns me an object of a C# class (called
> DBResultSet) that contains all the data from the query. This data has
> then
> to
> be visualized on the 2d-graph activeX control on the .aspx-page
> Here comes my question now:
> How can I access the properties & methods of the class DBResultSet to
> assign
> them to arrays and objects in jscript.
> I know that the activeX control and jscript work on the clientside and
> the
> application logic (written in C#) runs on the server. But the activeX
> control
> can only be accessed on the clientside and I need the data from the
> database
> to be displayed in the activeX-control.
>
> I hope, somebody can help
>
> thanks in advance
>
> RFS666


Nov 19 '05 #4
Hello Grant,
thanks for you quick and patient help,

you helped me really a lot!

RFS666
Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
2058
by: Christopher Brandsdal | last post by:
I have this string: /sites/binaer/demo/fil/Winnie-the-Pooh 1024x768.jpg If I wanted to cut everything before Winnie-the-Pooh 1024x768.jpg, how would I do this? In VBScript I could find the first "/" from the back of the sentence, and cut everything before that, but I'm not shore how to do this in JScript...
6
23767
by: Sergio Otoya | last post by:
Hi all, Is there any way of copying a file using javascript, not using the Filesystemobject (ActiveX). I need this to run in Windows and MACS. Any help would be greatly appreciated. Thanks in advance. Sergio Otoya.
14
2829
by: John Bentley | last post by:
Note this is crossposted to comp.lang.javacript and microsoft.public.dotnet.scripting. After some Googling and FAQing my understanding of these terms is, crudely: Javascript (3 different definitions): 1. The scripting language originally developed by Netscape. (I offer a Brief handle: "Original Netscape Script") 2. The current implementation of the ECMAscript 262 (3rd ed.) standard by Netscape. (I offer a brief handle: "Current...
1
6897
by: Peter Petrillo | last post by:
The Access development group here at this company has exported its reports in xml format from Access 2003. I have no influence on how they have created them. I received the following files xm xs xsl asp or html (my option Using a simple ASP.NET form with only a System.Web.UI.WebControls.Xml on it, I receive an error (below) that the scripting language 'vbscript' is not supported. The xslt file has in it vbscript scripting to...
2
2386
by: Zach Mortensen | last post by:
I can't seem to get dynamically-compiled JScript code to use C#-defined custom attributes. I have a simple attribute and a class defined in a C# assembly: namespace MyNamespace { public abstract class MyCsharpAttribute : Attribute { }
1
2496
by: Adrian | last post by:
I appear to be losing ViewState information when calling the __doPostBack function. I am attempting to use the showModalDialog to load a new web page which confirms that a user wishes to save a query. The showModalDailog returns a value to the original page which is used as a parameter in __doPostback, in turn trapped by the Page_Load procedure and processed.
2
1976
by: Jer425 | last post by:
Hello, I'm coding in VB and trying to include a jscript file. This will not work because you can only use one language in asp.net. Is there a way that I can use the jscript without having to convert it to VB? I heard something about using a component..is this true? Options? Thanks all!
83
4231
by: liketofindoutwhy | last post by:
I am learning more and more Prototype and Script.aculo.us and got the Bungee book... and wonder if I should get some books on jQuery (jQuery in Action, and Learning jQuery) and start learning about it too? Once I saw a website comparing Prototype to Java and jQuery to Ruby... but now that I read more and more about Prototype, it is said that Prototype actually came from Ruby on Rails development and the creator of Prototype created it...
9
7012
AnuSumesh
by: AnuSumesh | last post by:
Hi All, I have one dll written in c#. One of its methods return array of dictionary. I want to call and use that method in ASP file. I am using jscript in ASP. my code is a s follows: <% var cls;
0
9554
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9377
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10136
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9925
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9811
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8814
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7358
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3913
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.