Question concerning RegisterClientScriptInclude

W

WT

Having questions and problems with this method.
I have a control library that embed its .gif and js, html and htc in its
ressources
Corresponding Attributes are added to the namespace using declarative
syntaxe.

My questions
1) What should be the Type parameter of RegisterClientScriptInclude if I
call it inside the PreRender method of my custom control
should it be the Page type or the Control 's one
my gif images files are correctly retrieved and display but I can't get my
script being loaded by IE clients ???

More generally I don't understand the usage of this parameters,
dovcumentation is clumsy for it.

2) my gif images files are correctly retrieved and displayed only in run
mode, but refuses to load in design mode under vs2005 ?

3) what is the type to use in declaration for htc files, should I use
text/html like this ?
[assembly: WebResource("xxx.htc", "text/html")]

Thanks for help
CS
 
B

bruce barker \(sqlwork.com\)

If you are worried about key name being unique, you can use a type specifier
to futher refine the specification. Think of it as a namespace. if two
controls requester with the same key, but different types, then they won't
override each other.

in the past, in control libraries, you often appended the type name as a
prefix to the key to solve the same problem.

-- bruce (sqlwork.com)
 
W

Walter Wang [MSFT]

Hi,

Thank you for post!

1) I agree with Bruce on this issue: A client script include is uniquely
identified by its key and its type. Scripts with the same key and type are
considered duplicates. Only one script with a given type and key pair can
be registered with the page. So the Type parameter of
RegisterClientScriptInclude is used to further specify the identification
of the script script include. Normally you can just use the other version
which by default use the Page's type.

Regarding the issue about the script not being loaded, I think you may need
to check the name of script resource:
a) The resource name registered with [assembly: WebResource()] is
case-sensitive;
b) The resource name registered with [assembly: WebResource()] uses
project's default namespace as prefix, and includes resource folder name;

2) The gif image files are not shown in designer mode because
WebResources.axd is a http handler which requires HttpContext, and it's not
available in designer mode.

3) To include behavior in web resources, use "text/x-component":
[assembly: WebResource("xxx.htc", "text/x-component")]

Hope this helps. If there's anything unclear, please feel free to post here.


Regards,
Walter Wang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
W

WT

Thanks Bruce and Walter, my problem was in the 'text/x-component' type,
where could we find list of available types for resources ?

CS
 
W

Walter Wang [MSFT]

You can find MIME reference here:
http://www.w3schools.com/media/media_mimeref.asp

Have a nice day!


Regards,
Walter Wang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 

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,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top