Tagged Questions
0
votes
1answer
19 views
“anonymous type projection initializer should be simple name or member access expression” with Html.ActionLink
My action link helper is giving the error:
"anonymous type projection initializer should be simple name or member access expression"
Here's the link within my Partial View:
<%= ...
0
votes
0answers
22 views
Expression pointing to DateTime property is transformed into Convert(x.Timestamp)
I have the following code in my ASP.NET MVC application
public static IHtmlString NameFor<T>(this HtmlHelper html, Expression<Func<T, object>> expression)
{
return ...
0
votes
1answer
51 views
Lambda expression too complex for editor template
Within my view, I have a line of code that renders an editor template.
However, it returns the error:
Templates can be used only with field access, property access, single-dimension array index, or ...
2
votes
2answers
80 views
.Where Lambda expression loading entire table
I have set up an entity framework project with a code-first approach:
Link to code-first approach
I have added a method to access the repositories by inserting a function:
The interface for the ...
0
votes
1answer
42 views
c# lambda get the latest items on the generic list if the item is duplicate
I want to remove the old item from the list if there's a duplicate.
Here's my sample list:
1 Item1 Apr 27, 2013 $100
2 Item2 Apr 25, 2013 $200
3 ...
2
votes
2answers
73 views
Lambda Expression compiling with parameter
I want to extend MVC with helpers. Let's assume I want to build an extension method that takes a property from the model and renders a paragraph.
I've written this code, but it won't compile. I ...
0
votes
2answers
130 views
LINQ lamda OrderByDescending on group by key.count() returning list of string of group by key for chart legend sorting
Trying to sort the legend of a pie chart in MVC 4 C#. The chart shows number of products sold by their item numbers. In the legend I want to display the item number, then number sold, then the ...
1
vote
3answers
275 views
How to use Lambda in LINQ select statement
I am trying to select stores using a lambda function and converting the result to a SelectListItem so I can render it. However it is throwing a "Type of Expression in Select Clause is Incorrect" ...
0
votes
3answers
209 views
Building an indexed expression from another expression
Scenario
public class Element {
public int Id {get;set;}
}
public class ViewModel {
public IList<Element> Elements{get;set;}
}
I have a method with a parameter of type ...
1
vote
2answers
56 views
Multiple the value from lambda expression
I am trying to multiple the value from this expression (ProductPrice * x):
@Html.DisplayFor(model => model.ProductPrice)
0
votes
3answers
87 views
Lambda Query filter by Enum
I have the following lamba query that seems to always return all records even when the int? status pamameter is not null and valid. Anyone know why is the Enum filter not being honored?
Thanks for ...
1
vote
2answers
39 views
Attribute Properties that accept model expressions
I have a model with attributes, and these attributes refer to eachother in string form. eg.
public MyModel
{
[MyAttribute(BindTo = "Foo2")]
public string Foo1 { get; set; }
public string ...
1
vote
1answer
140 views
How Entity framework works with lambda in ASP.NET MVC
I am walking through Mvc Music Store tutorial from www.ASP.net website.
I have problem understanding how Entity Framework has created tables and how those lambda expressions work altogether. I do ...
2
votes
3answers
241 views
Chaining lambda expressions in MVC.Net without repetitious passing of HtmlHelper object
My goal is to create an object to allow chaining of commands in MVC.Net views.
Here is an example use in a view of a menu I created using this concept:
<nav class="navigation">
<%: Html
...
2
votes
3answers
218 views
How do I make a method that accepts multiple lambda expressions as parameters?
I'm trying to make my own Extension method that can take any number of lambda expressions, but It seems to choke any time I add more than one expression.
Here is the method:
public static ...