Dave's Technophorical Times

A blog about Microsoft's Technologies!
SharePoint :: MVC :: ASP.NET :: IIS :: SQL Server :: Visual Studio :: MS Access

Use this in the _layouts view to prevent the annoying left twitch if the content is longed than can fit on the display. The scrollbar moved the display to the left unless you put this in the _layouts View.

       /* prevent layout shifting and hide horizontal scroll */
        html {
            width: 100vw;
        }

        body {
            overflow-x: hidden;
        }


I recently came across a very annoying "feature" when developing an MVC5 site, and it took a few hours to resolve.

The white/blank above the navbar is the issue. To resolve this I added a margin-top: -50px in the Header of the _layouts view and all other _layouts that I had developed. Now it looks like this.

<style>
        body {
            margin-top: -50px;
        }
</style>



Check this link too. This works for MVC 5 too: http://stackoverflow.com/questions/12433736/asp-net-mvc-4-allow-dashes-hypens-in-urls

Dashed urls are much more SEO friendly and easier to read. (More on my blog post)

NuGet Package: https://www.nuget.org/packages/LowercaseDashedRoute/

To install it, simply open the NuGet window in the Visual Studio by right clicking the Project and selecting NuGet Package Manager, and on the "Online" tab type "Lowercase Dashed Route", and it should pop up.

Alternatively, you can run this code in the Package Manager Console:

Install-Package LowercaseDashedRoute

After that you should open App_Start/RouteConfig.cs and comment out existing route.MapRoute(...) call and add this instead:

routes.Add(new LowercaseDashedRoute("{controller}/{action}/{id}",
  new RouteValueDictionary(
    new { controller = "Home", action = "Index", id = UrlParameter.Optional }),
    new DashedRouteHandler()
  )
);

That's it. All the urls are lowercase, dashed, and converted implicitly without you doing anything more.

Open Source Project Url: https://github.com/AtaS/lowercase-dashed-route



The Blogger

Dave Stuart I'm a Developer with a passion for coding. I enjoy the challengers that come with the job! SharePoint is one of my expert areas along with .NET Web Development with MVC and good old MS Access VBA coding. I Blog so that I can remember how I did that way back when; PLUS all this stuff is searchable! I constantly study and run my own business, Dafran Inc. I have passed 22 Microsoft Exams since 1998 when I first jumped on the treadmill of knowledge. I hope that you enjoy this Blog as much as I enjoy updating it. All the very best from Calgary, Alberta, Canada. contact me at linkedin @ dafran.ca

Calendar

<<  March 2023  >>
MoTuWeThFrSaSu
272812345
6789101112
13141516171819
20212223242526
272829303112
3456789

View posts in large calendar

Sign in