Accessing Embedded Javascript

G

Guest

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
 
L

Laurent Bugnion

Hi,
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
 
G

Guest

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

Laurent Bugnion

Hi,
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,996
Messages
2,570,238
Members
46,826
Latest member
robinsontor

Latest Threads

Top