473,320 Members | 1,865 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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.RegisterClientScriptResource(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.Attributes.Add("onchange", "'<%=
WebResource(AddressCtrl.ChangeImage();) %>'");

any help is appreciated. thanks
Jul 5 '06 #1
4 1814
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.RegisterClientScriptResource(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.Attributes.Add("onchange", "'<%=
WebResource(AddressCtrl.ChangeImage();) %>'");

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.Attributes.Add("onchange", "yourClientSideFunction();");

Accepted, of course, that the function yourClientSideFunction 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.RegisterClientScriptResource(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.Attributes.Add("onchange", "'<%=
WebResource(AddressCtrl.ChangeImage();) %>'");

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.Attributes.Add("onchange", "yourClientSideFunction();");

Accepted, of course, that the function yourClientSideFunction 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
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
by: nets | last post by:
I have this (sorry if you not using fixed spacing font;-) |----------|---------------------| | Frame_1 | Frame_2 | | | |----------------| | | | | IFrame_1 ...
6
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...
0
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 (...
7
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...
0
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...
2
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() {...
5
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...
2
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...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.