Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 738459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:50:20+00:00 2026-05-14T07:50:20+00:00

I have an Asp.net MVC project that modestly uses jQuery scripts. My views also

  • 0

I have an Asp.net MVC project that modestly uses jQuery scripts. My views also display partial views in them, either returned using RenderPartial or RenderAction helper methods. Partial views are usually used to encapsulate some common display but they may as well have some client-side script functionality. My javascripts have the same names as views to which they are related.

So if I have a partial view UserInformation.ascx I have a matching UserInformation.js file. Most of these script files register functionality for DOM ready event so they won’t be executed immediately.

The problem is, that these scripts are added to parent views. So if a certain view uses my partial view it also needs to add its matching script file. So if someone forgets to add the script to main view, my partial view functionality won’t work.

In terms of browser execution and speed (or any other issues) is it better to include all scripts in XHTML head element or is it irrelevant if I’d reference these scripts inside my partial views? This way I could avoid human error of forgetting to add the script to the view? I could get a problem of referencing the same script file multiple times though. Especially if the same partial is used several times on the same view.

Are there any differences when we reference scripts inside HEAD or BODY elements?
Are there any doctype related issues (I’m using XHTML Transitional)?
What is the most common pattern?

It would be nice to have some sort of script registration functionality in Asp.net MVC that would prevent me from loading the same script file multiple times…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T07:50:20+00:00Added an answer on May 14, 2026 at 7:50 am

    If possible, it’s actually beneficial to place your scripts at the end of the <body> tag. That way, the browser doesn’t have to stop and interpret the scripts until after it’s seen all the page markup. The user sees the page and the site seems to load faster.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an asp.net mvc project that uses some search methods in a seperate
Hi I have a Visual Studio solution and an ASP.NET MVC project that uses
I have an ASP.NET MVC project and I have a single action that accepts
I have an ASP.NET MVC project with a form. In the Action method that
We have a ASP.Net MVC project that runs fine on our developer machines. When
We have an ASP.Net MVC project that will start with a single web server
I have an ASP.NET MVC project that works fine on my local machine (no
I have an ASP.NET MVC project that I'd like to install somewhere using xcopy
I have an existing ASP.Net MVC project that is using entities / repositories in
I have an ASP.NET MVC 2 project that I'm working on and I'm wondering

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.