Posts

Showing posts from May, 2020

Linq Query Syntax vs Method Syntax

Referenced from MSDN: https://msdn.microsoft.com/en-us/library/bb397947.aspx Query syntax: IEnumerable<int> numQuery1 =               from num in numbers             where num % 2 == 0             orderby num             select num; Method syntax:         IEnumerable<int> numQuery2 = numbers.Where(num => num % 2 == 0).OrderBy(n => n)

Sticky Footer made simple

CSS Footers are simple but people tend to overthink them.  Here is how it works You have two pieces A container that all your other stuff is in A footer that you want to always stay at the bottom of the page In Blazor I put this container on my content pages and not my host page because I didn't want my left hand nav to be involved <div class="container"> All my content </div> <footer> Centered footer content </footer> And the CSS .container {     width:100%;     padding: 0 15px; } footer {     font-size: 12px; (you could also use a vw value here)     padding-top:20px;     background-color: #xxx;     color: #fff;     margin: auto;     height: 60px;     width: 100%;     position: sticky; //absolute;     bottom: 0;     text-align: center; }

Ah Blazor - Now refresh the page!

Started my first Blazor project today.  New to NetCore as well so it was a fun challenge.  I like that is is similar to MVC  and I appreciate  the ability to add code into my page while building without moving to a controller - it was a real challenge to accommodate some JQuery but I got everything to work.  After looking a little closer I realized a large chunk of my JQuery and even javascript could be moved to the @code section and written differently - made for a cleaner, more readable page. I spent over an hour trying to figure out how to do a simple page refresh!  Part of the challenge is that Blazor is a moving target - different libraries and ways of doing simple tasks from version to version - I am confident that most of that will stop as they more clearly define what it is they want to do with this tool. Refresh a page (NetCore 3.1) First set up an alias for the uriHelper - you will now find it in NavigationManager @inject NavigationManager uriHelper Attach a method t