This question is locked. New answers and comments are not allowed.
Hello,
I just started using telerik ASP.NET MVC and I must admit that I am impressed. However, I am struggling with proper usage of ScriptRegistrar() in MVC3 using Razor. I have this in my _Layout.cshtml:
In my Index.cshtml, which I use for testing, I have this:
The rendered result is this:
Please note the position of the
Even more confusing it becomes when I use the .Combine(true) feature. Adding this to the two samples above will result in a non functioning PanelBar control.
I also tried using Script groups. When adding .Combine(true) to the default group but not to the custom group containing the PanelBar scripts ended in output where I can see the combined default group followed by the single PanelBar script include. Result: PanelBar did not work.
During my research I found a 'AssetKey' property I can set. But the docs don't tell me what it is good for or how to use it. My guess is that it somehow deals with WebAsset handling.
Maybe it is just my personal stupidity, but with the given documentation I am not able to use the ScriptRegistrar feature effectively. Can you please point me to samples that illustrate this issue in more depth or provide more in depth documentation?
Thanks a lot in advance!
Andreas
I just started using telerik ASP.NET MVC and I must admit that I am impressed. However, I am struggling with proper usage of ScriptRegistrar() in MVC3 using Razor. I have this in my _Layout.cshtml:
@(Html.Telerik().ScriptRegistrar().DefaultGroup(group =>
group.Add(
"jquery-1.5.1.min.js"
)
.Add(
"modernizr-1.7.min.js"
)
.Add(
"telerik.common.min.js"
))
)
In my Index.cshtml, which I use for testing, I have this:
@{ Html.Telerik().ScriptRegistrar().DefaultGroup(group => group.Add(
"telerik.panelbar.min.js"
)); }
The rendered result is this:
<script type=
"text/javascript"
src=
"/Scripts/jquery-1.5.1.js"
></script>
<script type=
"text/javascript"
src=
"/Scripts/2011.1.315/telerik.panelbar.min.js"
></script>
<script type=
"text/javascript"
src=
"/Scripts/jquery-1.5.1.min.js"
></script>
<script type=
"text/javascript"
src=
"/Scripts/modernizr-1.7.min.js"
></script>
<script type=
"text/javascript"
src=
"/Scripts/2011.1.315/telerik.common.min.js"
></script>
Please note the position of the
telerik.panelbar.min.js
file in the list. The result is a non functioning PanelBar. If I remove my ScriptRegistrar() call in the Index.cshtml file and rely on the auto-config of PanelBar the PanelBar JavaScript appears at last in the list and it works.Even more confusing it becomes when I use the .Combine(true) feature. Adding this to the two samples above will result in a non functioning PanelBar control.
I also tried using Script groups. When adding .Combine(true) to the default group but not to the custom group containing the PanelBar scripts ended in output where I can see the combined default group followed by the single PanelBar script include. Result: PanelBar did not work.
During my research I found a 'AssetKey' property I can set. But the docs don't tell me what it is good for or how to use it. My guess is that it somehow deals with WebAsset handling.
Maybe it is just my personal stupidity, but with the given documentation I am not able to use the ScriptRegistrar feature effectively. Can you please point me to samples that illustrate this issue in more depth or provide more in depth documentation?
Thanks a lot in advance!
Andreas