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

  • SEARCH
  • Home
  • 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 3981978
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:28:29+00:00 2026-05-20T05:28:29+00:00

I have an ASP.NET MVC 3 site that I’m trying to enable client-side validation

  • 0

I have an ASP.NET MVC 3 site that I’m trying to enable client-side validation on but I’m running into a really strange problem. The page loads and renders just fine until I include any javascript files. Once I do, any content below the script tag disappears completely. For example, this renders just fine (note the lack of a javascript include):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>@ViewBag.Title</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <link href="/assets/css/style.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
        <div class="main">
            @Html.Partial("Header")
            <div class="clr"></div>
            <div class="body_resize">
                <div class="body">
                    <div class="left">
                        @RenderBody()
                    </div>
                    <div class="right">
                        @RenderSection("RightContent")
                    </div>
                    <div class="clr"></div>
                </div>
                <div class="clr"></div>
            </div>
            @Html.Partial("BottomSection")
            @Html.Partial("Footer")
        </div>    
    </body>
    </html>

This, however, causes the entire page to be blank (note the addition of the jQuery link tag in the HEAD section):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>@ViewBag.Title</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link href="/assets/css/style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js" />
</head>
<body>
    <div class="main">
        @Html.Partial("Header")
        <div class="clr"></div>
        <div class="body_resize">
            <div class="body">
                <div class="left">
                    @RenderBody()
                </div>
                <div class="right">
                    @RenderSection("RightContent")
                </div>
                <div class="clr"></div>
            </div>
            <div class="clr"></div>
        </div>
        @Html.Partial("BottomSection")
        @Html.Partial("Footer")
    </div>    
</body>
</html>

If I move the script link tag to the bottom of the page, it renders fine again, but I’m pretty sure I’m not getting access to the jQuery library. I tried adding this just above the script include (which is now at the bottom of the page):

<script language="javascript" type="text/javascript">
        <!--
        $(document).ready(function () {
            alert('test');
        });
        //-->
    </script>

My alert never fired.

So additionally, the same thing is happening in a separate Partial View:

<div id="formContainer">
    @using (Html.BeginForm())
    {
        <div class="tRightBoxMid tClear">
        <p style="padding:0;">
        Your Name&nbsp;&nbsp;@Html.ValidationMessageFor(m => m.Name)<br />
        @Html.TextBoxFor(m => m.Name, new { style = "width:275px" })<br />
        Your Email Address&nbsp;&nbsp;@Html.ValidationMessageFor(m => m.Email)<br />
        @Html.TextBoxFor(m => m.Email, new { style = "width:275px" })<br />
        Your Message&nbsp;&nbsp;@Html.ValidationMessageFor(m => m.Message)<br />
        @Html.TextAreaFor(m => m.Message, 4, 100, new { style = "width:275px" })<br />
        <input type="submit" class="formButton" value="Send Message" /><div id="msgSent" style="display:none;"><br /><br /><font color='green'><b>Message sent! A representative will be in touch with you shortly.</b></font></div>
        </p>
        </div>  
    }
</div>

<script type="text/javascript" src="/Assets/js/jquery.validate.min.js" />
<script type="text/javascript" src="/Assets/js/jquery.validate.unobtrusive.min.js" />

My client validation is never firing (note the includes at the BOTTOM — page renders, but I’m not getting access to the included JS). If I move it to the top, the rest of my page loads, but this partial view disappears.

Long story short, any HTML that exists BENEATH a javascript include anywhere in my site seems to be disappearing and when I move the JS to the bottom, it’s like it’s not included at all. I’ve tried deleting all of the content from the various body and other sections to eliminate it, but it seems to be happening even when almost all markup and code is stripped out of the equation…anyone have any idea what’s going on here?

  • 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-20T05:28:29+00:00Added an answer on May 20, 2026 at 5:28 am

    try closing the script tag like this

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
    

    then try:

        <script language="javascript" type="text/javascript">
    
            $(document).ready(function () {
                alert('test');
            });
    
        </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have asp.net mvc intranet site that is deployed to IIS6. Site is used
I have a ASP.NET MVC site that is locked down using Forms Authentication. The
I have an ASP.Net MVC site that generates a Microsoft Excel 2003 XML formatted
I have a asp.net mvc site that references a couple of libraries. Recently I
I have an ASP.NET MVC site that uses both Microsoft Ajax [ Ajax.BeginForm() ]
Ok, so this is my dilemma... I have an ASP.NET MVC site that is
I have an asp.net mvc 1.0 site that serves some content from a 2
I have an Asp.net Mvc site where I want to give a separate access
I am building an Asp.net MVC site where I have a fast dedicated server
I've been developing a site using ASP.NET MVC, and have decided to use the

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.