Is it possible to add a javascript file to a PrevalueEditor?
I have used the uComponents AddResourceToClientDependency in other places where I have inherited from a control but my PrevalueEditor is inheriting from AbstractJsonPrevalueEditor so I'm not sure if it will work.
Yes it's definitely possible to use your own JavaScript in the Prevalue Editor.
Is your JavaScript an embedded resource, or on the file-system?
If it's an embedded resource, in your own assembly, then you'll need to call the AddResourceToClientDependency override that accepts the resourceContainer Type - as that's the assembly that contains the embedded resource.
Otherwise if it's on the file-system, then there's no uComponents' method for adding it... so you'll have to roll your own...
Yes it's an embedded resource, at least I think it is. All I've done is set the Build Action on the js file to Embedded Resource and my code looks like this
Yeah, the problem here is that the default method "AddResourceToClientDependency" is trying to look for the embedded resource from within the uComponents assembly... so instead you'd need to specify that you're using a different assembly.
I know it seems very long-winded, the code could be cut-down a little... (maybe using "this.GetType()" for the first parameter?) ... but best to get it working first! ;-)
I must have been using a reference to an old version of uComponents because I didn't have AddResourceToClientDependency with four parameters. And yes this.GetType() works for the first parameter.
I'm making something very similar to the Embeddable Content datatype but for my own purpose. I started making it ages ago to help with the Pliable Ajax Form project so that I can values and text to a select box. Also I like the way uComponents stores Prevalue data as json.
Add Javascript to PrevalueEditor
Is it possible to add a javascript file to a PrevalueEditor?
I have used the uComponents AddResourceToClientDependency in other places where I have inherited from a control but my PrevalueEditor is inheriting from AbstractJsonPrevalueEditor so I'm not sure if it will work.
Thanks
Ben
Hi Ben,
Yes it's definitely possible to use your own JavaScript in the Prevalue Editor.
Is your JavaScript an embedded resource, or on the file-system?
If it's an embedded resource, in your own assembly, then you'll need to call the AddResourceToClientDependency override that accepts the resourceContainer Type - as that's the assembly that contains the embedded resource.
Otherwise if it's on the file-system, then there's no uComponents' method for adding it... so you'll have to roll your own...
Cheers, Lee.
HI Lee,
Yes it's an embedded resource, at least I think it is. All I've done is set the Build Action on the js file to Embedded Resource and my code looks like this
But I still cant access any of the functions in my js file.
I also don't know if "_4Ben.DataTypes.MultiType.js.MultiTypeScripts.js" is the correct resourceName.
Any help would be much appreciated!
Thanks
Ben
Hi Ben,
Yeah, the problem here is that the default method "AddResourceToClientDependency" is trying to look for the embedded resource from within the uComponents assembly... so instead you'd need to specify that you're using a different assembly.
Try this...
I know it seems very long-winded, the code could be cut-down a little... (maybe using "this.GetType()" for the first parameter?) ... but best to get it working first! ;-)
Let me know if it works.
Cheers, Lee.
... also, I'm curious what you are developing ... if you can let us know, please do! :-)
Thanks, Lee.
Fantastic! Thanks!
I must have been using a reference to an old version of uComponents because I didn't have AddResourceToClientDependency with four parameters. And yes this.GetType() works for the first parameter.
I'm making something very similar to the Embeddable Content datatype but for my own purpose. I started making it ages ago to help with the Pliable Ajax Form project so that I can values and text to a select box. Also I like the way uComponents stores Prevalue data as json.
Many thanks again for the help!
Ben
You're welcome Ben. Best of luck with your project!
Next version of uComponents (v2.2) is due out in the next few weeks - but sure to check out the new DataType Grid data-type! :-)
Cheers, Lee.
is working on a reply...