This is a migrated thread and some comments may be shown as answers.

[Solved] Detail view with Tabstrip error

14 Answers 165 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
H
Top achievements
Rank 1
H asked on 11 Nov 2010, 06:59 PM
I get this error when I try to use a grid DetailView with a tabstrip:

Error 8 Delegate 'System.Func<object,object>' does not take 0 arguments c:\Program Files\Telerik\Extensions for ASP.NET MVC Q2 2010\Examples\Telerik.Web.Mvc.Examples\Views\Grid\DetailsServerSide.aspx 41 77 Telerik.Web.Mvc.Examples

It's on this line of code & is referring to the Content method:

items.Add().Text(

 

"Orders").Content(() =>

 

 

 {

 

I see it in the Telerik examples (above) but on the example it does not stop processing.  In my project the error prevents the view from displaying.

I notice that I see this when there is more than one tab in a tab strip, you get this & the following errors on all but the first tab - and you don't get the error on the first tab.

Error 9 Not all code paths return a value in lambda expression of type 'System.Func<object,object>' c:\Program Files\Telerik\Extensions for ASP.NET MVC Q2 2010\Examples\Telerik.Web.Mvc.Examples\Views\Grid\DetailsServerSide.aspx 41 77 Telerik.Web.Mvc.Examples

Error 10 Cannot convert lambda expression to type 'string' because it is not a delegate type c:\Program Files\Telerik\Extensions for ASP.NET MVC Q2 2010\Examples\Telerik.Web.Mvc.Examples\Views\Grid\DetailsServerSide.aspx 41 77 Telerik.Web.Mvc.Examples

Any suggestions?

14 Answers, 1 is accepted

Sort by
0
Hristo Germanov
Telerik team
answered on 12 Nov 2010, 08:56 AM
Hi H,

Could you please send me a sample project reproducing your issue, so I will be able to better assist you?

All the best,
Hristo Germanov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
H
Top achievements
Rank 1
answered on 12 Nov 2010, 02:25 PM
Thanks - my project is pretty large, but I get the same errors in the Telerik samples from the Q2 2010 release.

Could you look at that (see above) and let me know if you get the same compile errors?
0
Atanas Korchev
Telerik team
answered on 12 Nov 2010, 03:25 PM
Hello H,

 I cannot reproduce those problems in our example. Also it seems to work ok online. What do we need to do in order to see those errors?

Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
H
Top achievements
Rank 1
answered on 12 Nov 2010, 05:38 PM
I don't know - What I did was to just build the Examples & got the compile errors above.

When you build the example, do you see those errors?

I am able to run the example with the errors. 

In my own project the errors prevent the view from displaying & I don't know why that is either.
0
Atanas Korchev
Telerik team
answered on 12 Nov 2010, 05:45 PM
Hi H,

 No, I don't see any errors during compilation. I guess I need more info about your environment. Please specify the following:

  1. Which version of ASP.NET MVC are you using?
  2. Which version of Visual Studio?
I will prepare a working sample project matching those.

Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
H
Top achievements
Rank 1
answered on 12 Nov 2010, 06:23 PM
We're using asp.net mvc2 & I see the errors in both Visual Studio 2010 Professional & Visual Studio/Visual Web Developer Express.

Do you suppose it's some sort of build option or something we're missing?

Thanks!
0
Atanas Korchev
Telerik team
answered on 15 Nov 2010, 09:16 AM
Hi H,

 I am sending a working sample which compiles and runs without a problem. Does it work for you? If not - please send us some screenshot showing the error output.

Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
H
Top achievements
Rank 1
answered on 15 Nov 2010, 03:00 PM
Thank you for doing that.

I still see the same 3 errors but the app does run & the view works fine.

Error 1 Delegate 'System.Func<object,object>' does not take 0 arguments c:\Downloads\Nov15230731_telerik-web-mvc-examples\Telerik.Web.Mvc.Examples\Views\Home\Index.aspx 41 77 Telerik.Web.Mvc.Examples

Error 2 Not all code paths return a value in lambda expression of type 'System.Func<object,object>' c:\Downloads\Nov15230731_telerik-web-mvc-examples\Telerik.Web.Mvc.Examples\Views\Home\Index.aspx 41 77 Telerik.Web.Mvc.Examples

Error 3 Cannot convert lambda expression to type 'string' because it is not a delegate type c:\Downloads\Nov15230731_telerik-web-mvc-examples\Telerik.Web.Mvc.Examples\Views\Home\Index.aspx 41 77 Telerik.Web.Mvc.Examples

They are for the 2nd  "Items.Add" statement:

                            items.Add().Text("Contact Information").Content(() =>

                            {

                                %>

                                    <div class="employee-details">

Maybe I'll try the Ajax version & see if that works.


0
Atanas Korchev
Telerik team
answered on 15 Nov 2010, 03:15 PM
Hi H,

  I am not sure what is wrong but I don't see any build errors. I even enabled Build Mvc Views as part of the process and still I don't see any errors. Here is a video showing how things look at my side. Let me know if I am doing anything wrong.

Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
H
Top achievements
Rank 1
answered on 15 Nov 2010, 03:42 PM
I don't see anything that would explain the difference - I'll look into it on our end & see if I can find anything.

Thank you again for looking at this!
0
Jose
Top achievements
Rank 2
answered on 01 Dec 2010, 09:49 PM
I have the same problem, but only when the tabstrip contains an <%: Html.ActionLink(...) %> inside...
 
The debugger from visual studio 2010, shows the red underline on the second "(" from the line with ".Content(() =>"

tabstrip.Add()
.Text(
"Prueba")
.Content(
() => {%>
but, when I delete or cut the line with the ActionLink
, the error disappears...
0
Shreejit
Top achievements
Rank 1
answered on 06 Sep 2011, 10:18 AM
Hi,

I'm also facing the same issue. I'm attatching project along with the error screen shot. Please provide some information for this issue.

Note: i'm getting the same error in the attatched project in the reply by Atanas Korchev below.

Thanks,
Shreejit
0
Atanas Korchev
Telerik team
answered on 06 Sep 2011, 02:11 PM
Hello Shreejit,

 The attached project suffers from different problems.

First it is using <%= and Render() at the same (for the inner grid declaration).

The proper way to output a Telerik Extension is either to use <%= Html.Telerik().Grid() %> (as all other ASP.NET MVC html helper extensions) or <% Html.Telerik().Grid().Render(); %> if the component is using templates. The latter is needed because the <%= %> syntax does not support nesting and is specific to Telerik extensions. If you are using .NET 4.0 you can also use <%: Html.Telerik().Grid() %>. The <%: %> syntax will do the same as <%= %> thus has the same limitation - does not support nesting.

The second problem is that you are using a Entity Framework collection inside the ASPX page. The ASP.NET compiler does not import that namespace by default. You need to add the following line in your web.config to make the ASP.NET compiler recognize EF types:

<assemblies>
        <!-- other assemblies omitted for brevity -->
        <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
      </assemblies>

I am sending the updated project.

Kind regards,
Atanas Korchev
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Shreejit
Top achievements
Rank 1
answered on 07 Sep 2011, 06:34 AM
Thanks a lot Atanas, this really helped me a lot.
Tags
Grid
Asked by
H
Top achievements
Rank 1
Answers by
Hristo Germanov
Telerik team
H
Top achievements
Rank 1
Atanas Korchev
Telerik team
Jose
Top achievements
Rank 2
Shreejit
Top achievements
Rank 1
Share this question
or