I have tried what you suggested but without luck. The runat="server" from the head section disappears when I load the page - is it a special Umbraco thing?
The umbraco.library does not seems to have a ICleintScriptRegistrered method so how do you check that?
I succeeded with the use of umbraco.library and the runat.. in the case where I wanted to registrer a script file. Inline script does not show up in the rendered page.
I downloaded the source and saw that if you don't do the runat - means you don't have a header - it just fails back to the normal RegisterClientScriptBlock, so I'm still wondering why I had to use the umbraco.library to make a least one part work.
I don't think Umbraco will have brought in any restrictions here, it allows you to register script files without using the ScriptManager
You should be able to use the normal RegisterClientScriptBlock without any issues. You'll need to make sure you have a ScriptManager tag on your page though.
Registration of client script in a UserControl
I have made a new user control in which I want to add a script if it's not already registrered
if (!script.IsStartupScriptRegistered(typeof(SlideShow), "SimpleGalleryJS"))
{
txt = string.Format("<script type='text/javascript' src='{0}'></script>",
ResolveUrl("~/scripts/simplegallery.js"));
script.RegisterClientScriptBlock(typeof(SlideShow), "SimpleGalleryJS", txt);
}
It does however not get added to the page. Must it be done in a different way in Umbraco?
Thanks
Paul S
You can use umbraco.library.RegisterClientScriptBlock and it should work.
You will need to mark you <head> tag with runat="server"
I have tried what you suggested but without luck. The runat="server" from the head section disappears when I load the page - is it a special Umbraco thing?
The umbraco.library does not seems to have a ICleintScriptRegistrered method so how do you check that?
Thanks
Paul S
Hi Chris
I succeeded with the use of umbraco.library and the runat.. in the case where I wanted to registrer a script file. Inline script does not show up in the rendered page.
I downloaded the source and saw that if you don't do the runat - means you don't have a header - it just fails back to the normal RegisterClientScriptBlock, so I'm still wondering why I had to use the umbraco.library to make a least one part work.
- so why doesn't the ordinary way work ?
Paul S
I don't think Umbraco will have brought in any restrictions here, it allows you to register script files without using the ScriptManager
You should be able to use the normal RegisterClientScriptBlock without any issues. You'll need to make sure you have a ScriptManager tag on your page though.
Cheers,
Chris
Just need to add a <form id="xx" runat="server"> and it all works
Thanks for all your comments
Paul S
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.