Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - Using htc file in assemble include resource

Reply
 
Old 04-17-2008   #1 (permalink)
Pab


 
 

Using htc file in assemble include resource

I am developing the web controls and try to include all client files:
scripts, styles, etc in an assembly as resource common way like:
[assembly: System.Web.UI.WebResource("TLF.behaviour.htc",
"text/javascript")], and use ClientScriptManager class.

I have faced a problem with htc files, I get url following way:

class MyControl:WebControl
{
string GetUlr()
{
return this.Page. ClientScript.
GetWebResourceUrl(this.GetType(),”TLF.behaviour.htc”);
}
}
The method returns some like
“WebResource.axd?d=sVNSkov2zl0&t=633439341206302606” correctly.

But in run time no behavoior has been load – seems IE needs “.htc” file
extantion to attach behavoior. ?

Any suggestions?
Thanks


My System SpecsSystem Spec
Old 04-17-2008   #2 (permalink)
Anthony Jones


 
 

Re: Using htc file in assemble include resource

"Pab" <Pab@xxxxxx> wrote in message
news:9B13ECDD-3B3B-4583-BC1C-D69F79183782@xxxxxx
Quote:

> I am developing the web controls and try to include all client files:
> scripts, styles, etc in an assembly as resource common way like:
> [assembly: System.Web.UI.WebResource("TLF.behaviour.htc",
> "text/javascript")], and use ClientScriptManager class.
>
> I have faced a problem with htc files, I get url following way:
>
> class MyControl:WebControl
> {
> string GetUlr()
> {
> return this.Page. ClientScript.
> GetWebResourceUrl(this.GetType(),"TLF.behaviour.htc");
> }
> }
> The method returns some like
> "WebResource.axd?d=sVNSkov2zl0&t=633439341206302606" correctly.
>
> But in run time no behavoior has been load - seems IE needs ".htc" file
> extantion to attach behavoior. ?
>
A HTC is not Javascript, try using text/x-component instead of
text/javascript.

If that doesn't work then you might be right about it needing HTC extension.
behaviours in IE are an old technology.

Personally I would avoid them. .NET gives you alternatives for example if
you are adding a behaviour to an INPUT you can inherit the server side
representation and include some code to hook up the events you need and
inject what Javascript is needed.


--
Anthony Jones - MVP ASP/ASP.NET


My System SpecsSystem Spec
Old 04-17-2008   #3 (permalink)
Pab


 
 

Re: Using htc file in assemble include resource

Using text/x-component instead of text/javascript decided a point.
Great! Thanks!


"Anthony Jones" wrote:
Quote:

> "Pab" <Pab@xxxxxx> wrote in message
> news:9B13ECDD-3B3B-4583-BC1C-D69F79183782@xxxxxx
Quote:

> > I am developing the web controls and try to include all client files:
> > scripts, styles, etc in an assembly as resource common way like:
> > [assembly: System.Web.UI.WebResource("TLF.behaviour.htc",
> > "text/javascript")], and use ClientScriptManager class.
> >
> > I have faced a problem with htc files, I get url following way:
> >
> > class MyControl:WebControl
> > {
> > string GetUlr()
> > {
> > return this.Page. ClientScript.
> > GetWebResourceUrl(this.GetType(),"TLF.behaviour.htc");
> > }
> > }
> > The method returns some like
> > "WebResource.axd?d=sVNSkov2zl0&t=633439341206302606" correctly.
> >
> > But in run time no behavoior has been load - seems IE needs ".htc" file
> > extantion to attach behavoior. ?
> >
>
> A HTC is not Javascript, try using text/x-component instead of
> text/javascript.
>
> If that doesn't work then you might be right about it needing HTC extension.
> behaviours in IE are an old technology.
>
> Personally I would avoid them. .NET gives you alternatives for example if
> you are adding a behaviour to an INPUT you can inherit the server side
> representation and include some code to hook up the events you need and
> inject what Javascript is needed.
>
>
> --
> Anthony Jones - MVP ASP/ASP.NET
>
>
>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
include file name in output PowerShell
Backup: How to include JSP file type Vista account administration
Is there a way to get a file resource in PowerShelll? PowerShell
Include shared folder/file in "save" file list Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46