Solved

asp.net mvc5

Posted on 2016-10-31
3
50 Views
Last Modified: 2016-11-01
Hi Guys,

I have some weird issue.

I have mvc project and all my pages used to load the partial view _Layout.chhtml and all of a sudden the partial view doesn't show.

When I debug I can see that everything works fine but still I don't get all the packages from my partial view, although I'm getting the menu bar from the partial view, but still can't see the design.

I give you an example:

This is my partial view:
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>@ViewBag.Title - My ASP.NET Application</title>
    @Styles.Render("~/Content/css")
    <link href="~/Content/bootstrap-datepicker.css" rel="stylesheet" />
    @Scripts.Render("~/bundles/modernizr")
    <meta name="description" content="The description of my page" />
</head>
<body>
    <div id="wrapper">
        <!-- Sidebar -->
        <div id="sidebar-wrapper">
            <ul class="sidebar-nav">
                @if (User.Identity.Name == "")
                {
                    <li>
                        <a href="/Login/Index">Please Login</a>
                    </li>

                }
                else
                {
                    <li>
                        <a href="/Login/Logoff">Log off - <span style="text-transform:uppercase">@User.Identity.Name</span></a>
                    </li>
                }

                <li class="sidebar-brand">
                    <a href="#">
                        ALT - Home Application
                    </a>
                </li>
                <li>
                    <a href="/Home/Index">Dashboard</a>
                </li>
                <li>
                    <a href="/Journal/Index">Journal</a>
                </li>
                <li>
                    <a href="#">App1</a>
                </li>
                <li>
                    <a href="#">App2</a>
                </li>
                <li>
                    <a href="#">App3</a>
                </li>
            </ul>
        </div>
        <!-- /#sidebar-wrapper -->
        <!-- Page Content -->
        <div id="page-content-wrapper">
            <div class="container-fluid">
                <a href="#menu-toggle" class="glyphicon glyphicon-arrow-left" id="menu-toggle"></a>
                @RenderBody()
            </div>
            <!-- /#page-content-wrapper -->
        </div>
    </div>
   
    @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/bootstrap")
    <script src="~/Scripts/bootstrap-datepicker.js"></script>
    <script src="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script>
    <script src="https://cdn.datatables.net/1.10.12/js/dataTables.bootstrap.min.js"></script>
    <script src="~/Scripts/jquery-barcode.js"></script>
    <script src="~/Scripts/Toggle.js"></script>
    @RenderSection("scripts", required: false)
</body>
</html>

Open in new window


this is one of my pages:
@{
    ViewBag.Title = "Login";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@model Comapps.Models.LoginModel

<style>
    .login {
        margin: 0 auto;
        max-width: 350px;
    }

    .login-header {
        color: #fff;
        text-align: center;
        font-size: 300%;
    }

        .login-header h1 {
            text-shadow: 0px 5px 15px #000;
        }

    .login-form {
        border: 2px solid #999;
        background: #04519b;
        border-radius: 10px;
        box-shadow: 0px 0px 10px #000;
        color: #333;
        padding: 32px;
        -moz-border-radius: 10px;
        -webkit-border-radius: 10px;
    }

        .login-form h3 {
            text-align: left;
            margin-left: 40px;
            color: #fff;
        }

    .login-form {
        box-sizing: border-box;
        padding-top: 15px;
        margin: 50px auto;
        text-align: center;
        overflow: hidden;
    }

    .login input[type="text"],
    .login input[type="password"] {
        font-size: 18px;
        margin: 16px 0;
    }
    
    .login img {
        display: block;
        margin: 0 auto;
        margin-bottom: 30px;
    }
</style>

<center>
    <div class="login">
        <div class="login-form">
            @using (Html.BeginForm("Index", "Login", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "login", id = "frmlogin" }))
            {
                @Html.AntiForgeryToken()
                @Html.ValidationSummary(true, "", new { @class = "text-danger" })
                <img src="~/Img/login-pic.png" height="125" width="125" class="img-responsive" alt="Login to Malvar Portal" title="Login to Malvar Portal" />
                @Html.TextBoxFor(m => m.UserName, new { @class = "form-control input-lg", placeholder = "User Name" })
                @Html.ValidationMessageFor(m => m.UserName, "", new { @class = "text-danger" })

                @Html.PasswordFor(m => m.Password, new { @class = "form-control input-lg", placeholder = "Password" })
                @Html.ValidationMessageFor(m => m.Password, "", new { @class = "text-danger" })
                <div class="pwstrength_viewport_progress"></div>
                <button type="submit" name="go" id="go" class="btn btn-lg btn-primary" style="width:99%">Log in</button>
                <center><font color="red"> @ViewBag.message</font></center>
            }
        </div>
    </div>
</center>


@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
    <script type="text/javascript">
        jQuery(function ($) {
            toastr.options = {
                "closeButton": false,
                "debug": false,
                "newestOnTop": false,
                "progressBar": false,
                "positionClass": "toast-top-right",
                "preventDuplicates": false,
                "onclick": null,
                "showDuration": "300",
                "hideDuration": "1000",
                "timeOut": "5000",
                "extendedTimeOut": "1000",
                "showEasing": "swing",
                "hideEasing": "linear",
                "showMethod": "fadeIn",
                "hideMethod": "fadeOut"
            };

            $('#go').click(function () {
                if ($("#UserName").val() == "") {
                    toastr.error("You missed user name!!");
                    return false;
                }
                if ($("#Password").val() == "") {
                    toastr.error("You missed password!!");
                    return false;
                }
                if ($("#UserName").val() != "" && $("#Password").val() != "") {
                    $(this).text("Loging in please wait...");
                    $(this).attr('disabled', 'disabled');
                    toastr.info("Loging in please wait...");
                    $("#frmlogin").submit();
                }
            });
        });
    </script>
}

Open in new window

0
Comment
Question by:Moti Mashiah
  • 3
3 Comments
 
LVL 1

Accepted Solution

by:
Moti Mashiah earned 0 total points
ID: 41867701
I would like to mention one more thing.

my view start look like this:

@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}

Open in new window



I have debugged again and I can see that the partial view is show up, but still I don't get why I don't get all the scripts and css's.


Thanks,
0
 
LVL 1

Author Comment

by:Moti Mashiah
ID: 41868946
solved.
0
 
LVL 1

Author Closing Comment

by:Moti Mashiah
ID: 41868948
Was issue with my browser.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
A short film showing how OnPage and Connectwise integration works.

937 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

4 Experts available now in Live!

Get 1:1 Help Now