473,805 Members | 2,034 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Accessing Embedded Javascript

Hello - i have created a simple composite control with drop down list
displaying the US States. I have also a Javascript (County.js) file embedded
inside the control. The Javascript file has an array of County Names. IN
another Javascript i have a function that will display a list of county names
for the selected state. I am using the following to register the javascript
rstype = resource type; rsname = fully qualified resource name including the
namespace
csm.RegisterCli entScriptResour ce(rstype, rsname).

After i browse to the page i am able to download the Javascript file by
pasting the WebResource.axd ?......... into the Url but my "OnChange" event
for the Drop downlist does not fire. I am not sure why the Onchange is
failing.

Here is how the onchange is wired on the serverside

SelectCtrl.Attr ibutes.Add("onc hange", "'<%=
WebResource(Add ressCtrl.Change Image();) %>'");

any help is appreciated. thanks
Jul 5 '06 #1
4 1838
Hi,

roger31 wrote:
Hello - i have created a simple composite control with drop down list
displaying the US States. I have also a Javascript (County.js) file embedded
inside the control. The Javascript file has an array of County Names. IN
another Javascript i have a function that will display a list of county names
for the selected state. I am using the following to register the javascript
rstype = resource type; rsname = fully qualified resource name including the
namespace
csm.RegisterCli entScriptResour ce(rstype, rsname).

After i browse to the page i am able to download the Javascript file by
pasting the WebResource.axd ?......... into the Url but my "OnChange" event
for the Drop downlist does not fire. I am not sure why the Onchange is
failing.

Here is how the onchange is wired on the serverside

SelectCtrl.Attr ibutes.Add("onc hange", "'<%=
WebResource(Add ressCtrl.Change Image();) %>'");

any help is appreciated. thanks
I might be wrong, but...

The string in the "onchange" attribute is executed in the client's
context. For the client, it's the same if the resource is embedded or
not on the server. By using the WebResource.axd , you send the embedded
resource to the client, so the client has it.

Using the client's context, I think it should work if you write

SelectCtrl.Attr ibutes.Add("onc hange", "yourClientSide Function();");

Accepted, of course, that the function yourClientSideF unction is defined
in the script file.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
Jul 5 '06 #2
Thanks Laurent. I tried that one too but it did not work. Has this worked for
you?

"Laurent Bugnion" wrote:
Hi,

roger31 wrote:
Hello - i have created a simple composite control with drop down list
displaying the US States. I have also a Javascript (County.js) file embedded
inside the control. The Javascript file has an array of County Names. IN
another Javascript i have a function that will display a list of county names
for the selected state. I am using the following to register the javascript
rstype = resource type; rsname = fully qualified resource name including the
namespace
csm.RegisterCli entScriptResour ce(rstype, rsname).

After i browse to the page i am able to download the Javascript file by
pasting the WebResource.axd ?......... into the Url but my "OnChange" event
for the Drop downlist does not fire. I am not sure why the Onchange is
failing.

Here is how the onchange is wired on the serverside

SelectCtrl.Attr ibutes.Add("onc hange", "'<%=
WebResource(Add ressCtrl.Change Image();) %>'");

any help is appreciated. thanks

I might be wrong, but...

The string in the "onchange" attribute is executed in the client's
context. For the client, it's the same if the resource is embedded or
not on the server. By using the WebResource.axd , you send the embedded
resource to the client, so the client has it.

Using the client's context, I think it should work if you write

SelectCtrl.Attr ibutes.Add("onc hange", "yourClientSide Function();");

Accepted, of course, that the function yourClientSideF unction is defined
in the script file.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
Jul 6 '06 #3
Hi,

roger31 wrote:
Thanks Laurent. I tried that one too but it did not work. Has this worked for
you?
So far I made only preliminary tests with the Webresource.axd , I'll have
to test more and get back to you about that.

Greetings,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
Jul 6 '06 #4
Thanks and much appreciated

"Laurent Bugnion" wrote:
Hi,

roger31 wrote:
Thanks Laurent. I tried that one too but it did not work. Has this worked for
you?

So far I made only preliminary tests with the Webresource.axd , I'll have
to test more and get back to you about that.

Greetings,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
Jul 7 '06 #5

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

Similar topics

1
2999
by: Julius Mong | last post by:
Dear all, I have something like this: <html... > <embed ...> </html> Am I out of luck if I wanted to access the embedded DOM and manipulate its content? Or if I have:
1
1362
by: nets | last post by:
I have this (sorry if you not using fixed spacing font;-) |----------|---------------------| | Frame_1 | Frame_2 | | | |----------------| | | | | IFrame_1 | | | | |----------------| | | | | | | <a onClick=... | |----------|---------------------|
6
2749
by: Chris Styles | last post by:
Dear All, I've been using some code to verify form data quite happily, but i've recently changed the way my form is structured, and I can't get it to work now. Originally : The form is called "form1", and I have selects called "PORTA", "PORTB" ... etc...
0
1585
by: ChristianD | last post by:
for some reason i can't access a resource (.js) if the control files and the resource are in a subfolder off the project root or just the resource is in a subfolder. the code is as follows ( this is an example with the resourse in a sub-folder called Resources): private void RegisterScript(Control targetControl) { String pageScriptName = "Cbs.Ui.Controls.Resources.ControlScript"; if (...
7
1882
by: ian ward | last post by:
Hello, I want to show the result of some JavaScript on an HTML page. I've had a look at some threads and it seems the conclusion is the following - javascript entities are usable on the right-hand side of attribute/value pairs (with some appropriate syntax involving curly brackets and ampersands) and, furthermore, this only works for attributes of "link type" html elements. If this is the case then I'm a bit stuck, but I'd like to...
0
1088
by: berek | last post by:
Is it possible to access a method of embedded windows forms control from code-behind code (not from javascript)? I have UserControl.dll embedded within <objecttag and i would like to pass to it some information from within Page_Load() handler.. And maybe it is even possible to call somehow the constructor of embedded control (passing some parameters)? The <paramtag won't help me cause i don't have needed information by then (Request).
2
8171
by: Owen.Leibman | last post by:
Here is a complete web page: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> <html> <head> <title>Javascript Embed and onunload</title> <script type="text/javascript"> function useplayer() { var a = document.getElementById("obj1"); var obj = document.createElement("object"); obj.data = "dayenu.mid";
5
2873
by: makthar | last post by:
Hi I need to call a javascript function defined in a html file from a javascript function defined in an external javascript file(.js). Can anyone suggest me how do i do/acheive this functionality. thank u Mansoor
2
2421
Frinavale
by: Frinavale | last post by:
I am attempting to use embedded resources in an Ajax Enabled ASP.NET Web Application. I'm using Visual Studio 2008 and VB.NET server side code. The project is called "EmbeddedResources" with the namespace "EmbeddedResources" My resources are not included when the content is rendered in the browser. I have marked my JavaScript resource as Embedded. I am able to retrieve the path to the resource from the WebResource.axd HTTP Handler during...
0
9596
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
10604
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
10361
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
9179
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
7644
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
5676
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4316
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
2
3839
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3006
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.