471,581 Members | 2,231 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Accessing embedded resource in subfolder?

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 ( !this.Page.IsClientScriptBlockRegistered(pageScrip tName) ) {
using (System.IO.StreamReader reader = new
System.IO.StreamReader(typeof(Cbs.Ui.Controls.Firs tFocus).Assembly.GetManifestResourceStream(typeof( Cbs.Ui.Controls.FirstFocus),
"Cbs.Ui.Controls.Resources.ControlScript.js")) ) {
String script = "<script language='javascript' type='text/javascript'
\r\n<!--\r\n" + reader.ReadToEnd() + "\r\n//-->\r\n</script>";

this.Page.RegisterClientScriptBlock(pageScriptName , script);
}
}

the code failes on the using line with the error:
Value cannot be null. Parameter name: stream

Everything works fine if its all in the root and refer to the script as just
"ControlScript.js"

I understand that the fully qualified name of a resource in a sub-folder
should be <namespace>.<subfolder>.<resourcename>.<extension> .

Am i missing something?

Thanks,
Christian
Nov 18 '05 #1
0 1513

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Philipp Seidel | last post: by
1 post views Thread by Sreekanth | last post: by
3 posts views Thread by C-Services Holland b.v. | last post: by
reply views Thread by Aleksey Tkachenko | last post: by
4 posts views Thread by roger31 | last post: by
reply views Thread by Matthew Brealey | last post: by
4 posts views Thread by moondaddy | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by lumer26 | last post: by
reply views Thread by lumer26 | last post: by

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.