I'm trying to use the ClientDependency inside the view of a grid component but when @Html.Raw(Html.RenderJsHere()) is called all other scripts in the base template are rendered but the ones assigned inside the grid view are not.
Does anyone knows a way to make ClientDependency works with grid views?
You presumably only want to have a single location where the JS is rendered. Probably that is just before your closing </body> tag.
I'd add all the Html.RequiresJs you need in the Grid but leave the JS rendering till later. If you really need to render out in two different places then check out Forced Providers.
That's exactly what I'm doing, sorry for not being more clear.
What I have just noticed is that when running it locally in iis express it correctly renders the script files assigned in the grid view.
Are you doing caching? I've had issues with @Html.CachedPartial(). Because it just renders the cached output (second time around) and Html.RequireJs() never gets called.
Finally I found the problem and you are right. I'm using Donut Cache and LeBlender for the grid.
It seems like LeBlender doesn't support very well Donut caching.
I'll would need to do more work on this...
ClientDependency Framework & grid view
Hi
I'm trying to use the ClientDependency inside the view of a grid component but when @Html.Raw(Html.RenderJsHere()) is called all other scripts in the base template are rendered but the ones assigned inside the grid view are not.
Does anyone knows a way to make ClientDependency works with grid views?
My code inside the view is:
And the render takes place in a partial view:
You presumably only want to have a single location where the JS is rendered. Probably that is just before your closing
</body>
tag.I'd add all the
Html.RequiresJs
you need in the Grid but leave the JS rendering till later. If you really need to render out in two different places then check out Forced Providers.Hi David
That's exactly what I'm doing, sorry for not being more clear.
What I have just noticed is that when running it locally in iis express it correctly renders the script files assigned in the grid view.
Now when deployed to Azure it stops working...
Any hint is highly appreciated.
Thanks
Are you doing caching? I've had issues with
@Html.CachedPartial()
. Because it just renders the cached output (second time around) andHtml.RequireJs()
never gets called.Finally I found the problem and you are right. I'm using Donut Cache and LeBlender for the grid.
It seems like LeBlender doesn't support very well Donut caching.
I'll would need to do more work on this...
Thank you very much for all the hints!
is working on a reply...