Click here to Skip to main content
15,908,172 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I create a HTMLHelper for asp.net MVC which generate and ,and placed in body when control render .bellow is code sample structure

HTML
<div id='someid'></div>
<span id='spanid'></span>
<script>
//some function
</script>


I want to place the script part into section placed bottom of the page . Like I have a section

HTML
<div id='someid'></div>
<span id='spanid'></span>

    @section scripts{
    <script>
    //some function
    </script>
    }



Is it possible programmatically?a code sample will be appreciated.

What I have tried:

I think,if is there way in ASP.Net MVC builtin to find a section by name then
Find section by name
and append script to end
I googled for finding section by name but unfortunately not found any builtin ASP.Net MVC code.
Posted
Updated 19-Apr-17 17:39pm
v2
Comments
j snooze 19-Apr-17 17:41pm    
I'm not understanding what you are trying to do. Are you trying to put certain javascript code in the script tags based off of some trigger like the section name?

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900