Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 275759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T00:49:00+00:00 2026-05-12T00:49:00+00:00

After having worked in MVC for a few months, I’m back in a previously

  • 0

After having worked in MVC for a few months, I’m back in a previously written WebForms 3.5 application, and I’m trying to fix up what I can with what I’ve learned.

Part of this is the “strongly-typed model with a partial view” concept which is incredibly awesome. By inheriting my custom “ListTemplate” control, I can then use its GetModel() method to get something resembling this:

<% List<Models.CaseStudy> model = GetModel<Models.CaseStudy>(); %>

I can then run a foreach over model, and all is happy. However, I wanted to do a grouping so I added references to:

<%@ Import Namespace="System.Linq" %>
<%@ Import Namespace="System.Linq.Expressions" %>

Then, with a slightly less-than-ideal syntax, tried this:

<% IEnumerable<IGrouping<string, Models.CaseStudy>> model = GetModel<Models.CaseStudy>().GroupBy(e => e.Client.Name); %>

But no! “Compiler Error Message: CS1525: Invalid expression term ‘>'” – and it appears to be the lambda at fault. It doesn’t work if I put the GroupBy() in the foreach parameters either.

Is there any way to get lambdas working within ASCX files?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T00:49:01+00:00Added an answer on May 12, 2026 at 12:49 am

    Based on the error message, my first instinct would be to say that you are using the C# 2.0 compiler.

    I’m not sure what the return type of GetModel<T> is. But even if it’s an empty method, the actual lambda expression is a valid syntactical construct. It should produce an overload resolution error, not a parsing error.

    However this is not the case in the C# 2.0 compiler. It would be an invalid syntactical construct and would produce that error message.

    Can you check to make sure you are using the correct version of the C# compiler?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.