Friday, February 3, 2012

Using the Umbraco Object in a Umbraco 5 Template

If you want to use the Umbraco object in Templates then you need to add @inherits RenderViewPage to the top of your template (View).  Its best to do this on a Master Template so you only need to add it once. 


If you don't do this you will get an error like CS0234: The type or namespace name 'Field' does not exist in the namespace 'Umbraco' (are you missing an assembly reference?)




Umbraco 5 Hanging on Install IIS7

First chance today to look at Umbraco 5. Unfortunately I haven't looked at many of the previous versions of Umbraco 5 so was really keen to get into it and start a new project so I could all the new cool features.

Unfortunately I got stopped at the first step, created a new database, created a new site IIS 7 and browsed to the new site. The install just hang with the wait cursor just going round and round. After going insane for a few hours I discovered the fix was disbale Link Scanner in AVG. You can disable this by opening the AVG user interface goto tools > advanced settings > link scanned then unticking the 3 options. Hope this gets you on your way. Hoping to bring you lots more Umbraco 5 blog posts in the weeks and months to come.

Thursday, October 6, 2011

My First Facebook Application

Recently I have been exploring the Facebook Graph and API and was asked to create a Week By Week Pregnancy application for OHbaby!.

It basically does the following
- You enter your babies date of birth (Due date calculator) found here.
- OHbaby! sends you a week by week account of what your baby is up to.

We are using Quartz.net to schedule the job which seems to be working pretty well so far (When we get 1000's of user we'll see how it goes)

So far I am pretty happy with how its going. Posting messages to Facebook seem to be working pretty well thanks to the Facebook C# SDK.

Check out the application at http://apps.facebook.com/pregnancyweekbyweek/ to see the flow.

Sunday, September 11, 2011

Jquery Validate Form Submit Before Opening Popup Window

Sometimes you want to open a form submit in a new window.  Think facebook extended permissions popup window.  To achieve this you would do something like the following.

<script type="text/javascript">
    $(document).ready(function () {
               if ($('#myform').valid()) {
                window.open('', 'formpopup', 'width=800,height=600,resizeable,scrollbars');
                this.target = 'formpopup';
             });
    });
</script>

However you wouldn’t want to open the popup window unless the form being submitted in valid.

If you are using jquery.validate then its pretty easy to update the above javascript to this:

<script type="text/javascript">
    $(document).ready(function () {
        $('#myform').submit(function () {
            if ($('#myform').valid()) {
                window.open('', 'formpopup', 'width=800,height=600,resizeable,scrollbars');
                this.target = 'formpopup';
            }
        });
    });
</script>

 

Hope this helps someone.

Thursday, September 8, 2011

Go All Blacks | OHbaby! New Zealand

Here is a Mosaic I put together for OHbaby! in support of the Allblacks in the upcoming Rugby World Cup 2011.

Go All Blacks | OHbaby! New Zealand

Thursday, April 8, 2010

Only allow approved members to Login + Umbraco

This is how I go about not allowing Umbraco members to login whn they haven't been approved.

In my MemberType I have a True/False datatype called Active.

On my MemberLogin user control page my asp.net member login control looks like



<asp:Login ID="lgMember" OnLoggingIn="Login1_LoggedIn" CssClass="login" VisibleWhenLoggedIn="false" DestinationPageUrl="/Members.aspx"
LabelStyle-VerticalAlign="middle" LabelStyle-CssClass="LoginLabel" TextBoxStyle-Width="100px" UserNameLabelText="Login"
PasswordLabelText="Password" TitleText="" DisplayRememberMe="false" runat="server" />

In the codebehind my Login1_LoggedIn event looks like.

protected void Login1_LoggedIn(object sender, EventArgs e)
{
//get member
Member m = Member.GetMemberByName(((Login)sender).UserName.ToString(), false).First();

if (m.getProperty("Active").Value.ToString() != "1")
{
FormsAuthentication.SignOut();
HttpContext.Current.Response.Redirect(umbraco.library.NiceUrl(1091));
}

}


This will redirect the user to a page explaining their membership hasn't been enabled yet.

Friday, April 2, 2010

nopCommerce and Umbraco

I have two major passions when it comes to .net open source projects and they are Umbraco and nopCommerce.  What I am planning on doing is building a nopCommerce package for Umbraco.  There are plenty of good commerce packages already for Umbraco and I have nothing against these packages I just love nopCommerce and would like to be able to use it within the Umbraco framework.  I don’t think is going to be a quick task and will probably need to be spanned over many months.  I’m going to try and blog what I do so other .Net applications might be able to use some of the challenges I encounter and how they might go about resolving them.   Please check back here regularly to check on my progress.  Will also try and get a package up into codeplex.  Wish me luck!