Asp.net mvc de @section ile özellikle scriptlerimizi koymak için sıklıkla section tanımlıyor. Bazen partial içerisinde javascript kodları eklememiz gerekiyor.
Partial views don’t support @section tag. You should add them in the view which references the partial view. See this question for more information: Injecting content into specific sections from a partial view ASP.NET MVC 3 with Razor View Engine.
Bu yüzden için bir yöntemimiz var
bir extensiyon ekliyoruz.
https://gist.github.com/mahmut-gundogdu/d9145a928620e0c93cd8b4d47f7d7f0a
peki bu nerde çalışıyor _Layout.html de
@RenderSection(“Scripts”, required: false)@Html.RenderScripts()
renderscripts hallediyor
@Ahmet Pirimoğlu üstada saygılar teşekkürler.
Kaynnak: http://stackoverflow.com/questions/5433531/using-sections-in-editor-display-templates/5433722#5433722
İlk Yorumu Siz Yapın