none
Sorting in GridView on a LinqToSql gives exception RRS feed

  • Question

  • If this is the wrong section. Apologies. But Viz2008 is still called prerelease for some reason.

    I have a LinqDataSource providing a data dource to a gridview

    in the gridview i have a column called "ProjectName" which is the same name of the sort expression property for that column also.

    The ProjectName Property is defined as

        public string ProjectName {
            get { // return Project != null ? Project.Name : String.Empty;  *** This is taken out because for some reason projects are not showing up *** 
                ContractorSurveyDataContext db = new ContractorSurveyDataContext();

                Project project = (from d in *******
                                   where d.Id == *********
                                   select d).Single<Project>();

                return project.Name;
            }
        }

    This works in for displaying the grid and sorting all all other properties, except this property

    This is a public partial class extension.

    Any ideas> I would prefer to let the GridView do the sorting because I do not want to custom code the paging and dorting myself.

    Thanks,
    Tuesday, October 7, 2008 3:58 PM

Answers