linq, mvc and partial class

I have dbml with single table users

i want add partial class for User and add another property like so:

    public partial class User
    {
        public string FullName
        {
            get
            {
                return FirstName + " " + LastName;
            }
        }
    }

and then use in my View something like:

<%=ViewData.Model.FullName %>

here what im getting:

CS1061: 'PR.Web.Models.User' does not contain a definition for 'FullName' and no extension method 'FullName' accepting a first argument of type 'PR.Web.Models.User' could be found (are you missing a using directive or an assembly reference?)

what im doing wrong???

Answers


Double check the namespace of the generated LINQ to SQL class (User) and the partial class.

You may be sure that it's "all definitely correct", but the compiler is telling you otherwise. Post the relevant sections of the .designer.cs file nested under your .dbml file if necessary, as well as the full source for the file that contains the User class you posted above.


Need Your Help

Fastest way to flush a hashmap to disk into an sorted set

java list sorting queue hashmap

I have a Map&lt;byte[], Element&gt; and I want to sort it and write it to disk, so that I have a file with all the elements sorted by key through Guava's UnsignedBytes.lexicographicalComparator.

Distance between two coordinates in 3D space of a prism

c 3d coordinates distance

I have a homework problem that asks the user for the vertices of a rectangular prism located in 3-D space. I need to calculate the surface area and volume of the prism. I have to have a function that

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.