2017-08-02 12 views
0

私はexcerptというテキストボックスフィールドをUmbraco 7のデフォルトのブログ投稿文書タイプに追加しました。Umbracoは、その抜粋フィールドのデータにアクセスしようとするとコンパイルエラーを報告します。デフォルトのブログ投稿文書タイプでカスタムテキストボックスフィールドにアクセスするにはどうすればよいですか?

@{ 
    var recentblogpost = Model.Content.Site().FirstChild("BlogPostRepository").Children("BlogPost").Last(); 
} 

@recentblogpost.Name, @recentblogpost.excerpt 

@recentblogpost.Nameまたは@recentblogpost.Url成功を取得:私のテンプレートで

@recentblogpost.excerptのような追加するカスタムフィールドだけが成功しません。大文字小文字の区別を@recentblogpost.Excerptに変更しようとしました。

報告されたエラー:

Compiler Error Message: CS1061: 'Umbraco.Core.Models.IPublishedContent' does not contain a definition for 'excerpt' and no extension method 'excerpt' accepting a first argument of type 'Umbraco.Core.Models.IPublishedContent' could be found (are you missing a using directive or an assembly reference?)

答えて

0

このスニペットは働いていました。 @recentblogpost["excerpt"]

関連する問題