Adding break after image BlogEngine.Net

I got really annoyed by BlogEngine about images and content wrapping. To add a break after an image simply add:

 style="clear:both;"

 

To the element after the image.

Divelicious - Migration to MVC, install bootstrap (3.0)

We are migrating the existing web.forms website to MVC, in combination with Bootstrap 3.0 which got release 24-08-2013. During the migration we will try to blog the steps which are according to us interesting to write about. First step is to add Bootstrap to the website using NuGet.

Right Click the Website project and choose Manage NuGet Packages... 

Select Bootstrap from NuGet

 Type bootstrap in the searchbox and depending on your wishes select the types of versions which need to be displayed (stable / prereleases) . You will notice that the bootstrap package shows up in the list. Select is and install.

Files where added to the project

The installation installs JQuery if it was not already installed and the stylesheets and scripts to get started.

 

Installed files 

You'll notice the files which where installed in the Content and Scripts folder. The Custom Less file is added by me to add custom styles or overrides to bootstrap if needed.

 

Global Resources not working in Production Environment

Just deployed my solution to a production environment to notice that the Global Resources where not working properly. The first thing which comes to mind is are the actually on the production server and it appears they where not.

The reason was because the resource file was marked as embedded resource instead of content.

 

Mark your global resources as content

Be sure to mark your resource file as content so that it get's compiled. You can notice the difference when you're investigating the result of the build. Notice that in the first build it's actually an embedded resource and in the second a compiled dll.

 

Another fine solution

Hope this makes your day.

 

Avoid imports on ASPX pages

Sometimes you want to refer to constants or use an extension method in your aspx code. To get to these methods you can add imports to your pages like:

<%@ Import Namespace="PropertyWell.WebUI.Code.UIConstants" %>
<%@ Import Namespace="PropertyWell.Common.Extensions" %>

If you don't want to add these to your pages because you use them regularly you can add them to your web.config.

  <system.web>  
  <pages>
      <namespaces>
        <add namespace="System.Web.Helpers" />
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
        <add namespace="System.Web.WebPages" />
        <add namespace="PropertyWell.WebUI.Code.UIConstants" />
        <add namespace="PropertyWell.Common.Extensions" />
      </namespaces>
    </pages>
  </system.web>

Using local resources at design time

There are different types of resources and one of them is local resources. When you want to use your local resources at design time you have multiple options in using them one of them is. The control on which we are using the local resource is OpenAuthProviders.ascx

 

Alternate Text and Title

As you'll notice the local resource is used as alternate text and as a title. The local resources are defined as strings in the associating local resource file(s).  

Success in localizing your site(s)

Hope you'll be able to use this in the future. 

This code is used on http://www.propertywell.com/

 

Using local resources on a WebForm

If you want to use local resource text on a webforms page you can wrap it in a literal control or create a public or protected method on your code behind or base page. By creating a method like:

 

        public string GetLocalResource (string key)
        {
            object resourceString = GetLocalResourceObject(key);

            return (resourceString != null) ? resourceString.ToString() : "Resource not available";
        }

You can use local resources on your webform like:

<h1><%= GetLocalResource("resourcekey") %></h1>

or when your in a databound control:

 

<%# GetLocalResource("resourcekey") %>

 

Hope this is of any use o you in the future.

How to start with your first MVC application

Just added a walktrough about how to create your first MVC application and some additional information about the MVC pattern.

http://www.techned.nl/page/Creating-your-first-MVC-application

Reading: Pro JavaScript for Web Apps (Adam Freeman)

I would recommend reading this book which was written by Adam Freeman.

 "This is my 15th book about technology, and to mark this, Apress asked me to do something different: share the tools, tricks, and techniques that I use to create complex client-side web apps. The result is something that is more personal, informal, and eclectic than my regular work. I show you how to take industrial-strength development concepts from server-side development and apply them to the browser. By using these techniques, you can build web apps that are easier to write, are easier to maintain, and offer better and richer functionality to your users."

 

Reading: Pro ASP.Net MVC4

I would recommend reading this book which was partially written by Steve Sanderson, who is a great speaker and writer. Definatelly worth reading.

A new beginning

Started this new blog, not sure if the old content will be migrated. Aim is to collect anything related to the .Net framework and share knowledge.

Sponsored by

Calendar

<<  February 2018  >>
MoTuWeThFrSaSu
2930311234
567891011
12131415161718
19202122232425
2627281234
567891011

View posts in large calendar

RecentComments

TextBox