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

Bind to model and avoid load on demand

2 Answers 118 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Chris Williams
Top achievements
Rank 1
Chris Williams asked on 27 Oct 2011, 02:34 AM
I am binding my tabstrip to my model.  I'd like the content of the tabstrip pane to be fully populated when the page loads and because of that I want to avoid Load on Demand.  However, when I try to do this using the .Content(() =>{}) method, I get a run-time error.  Load on demand works fine.

This is an example of what's current working (load on demand):

<% Html.Telerik()
        .TabStrip()
        .SelectedIndex(0)
        .Name("ChartSeries_" + chart.Name)
        .BindTo(chart.Series, (item, series) =>
                                  {
                                      item.Text = series.Name;
                                      item.ImageUrl = Url.Content("~/content/images/report16n.png");
                                        
                                      item.ContentUrl = Url.Action("ShowChartOptions",
                                                                   new
                                                                       {
                                                                           chartType = series.ChartType,
                                                                           selection = series.ChartSubType
                                                                       });
                                  })
         .Render(); %>

However, when I try to do anything with the .Content method, it fails.  Any ideas?  The exact error is "error CS1593: Delegate 'Action' does not take 1 arguments".

This doesn't work:

<% Html.Telerik()
       .TabStrip()
       .SelectedIndex(0)
       .Name("ChartSeries_" + chart.Name)
       .BindTo(chart.Series, (item, series) =>
                                 {
                                     item.Text = series.Name;
                                     item.ImageUrl = Url.Content("~/content/images/report16n.png");
                                     item.Content(() =>
                                                      {%>
                                                          Some random content I want to appear
                                                    <% });                                                         
                                 })
        .Render(); %>

p.s. I'm using 2011.2.1006, which was provided to me as a hotfix for an unrelated issue.

2 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Tunev
Telerik team
answered on 28 Oct 2011, 01:30 PM
Hello Chris,

I just answered your support ticket on the same subject. For convenience, I am pasting my reply below:


**********************************************
The problem in the second code snippet is that Content is a property, not a method. Here is the correct syntax:

        .BindTo(Model,
(item, navigationData) =>
{
    item.Text = navigationData.Text;
    item.ImageUrl = navigationData.ImageUrl;
 
    item.Content = () =>
    {%>
                        Some random content I want to appear
                <% };
})



All the best,
Georgi Tunev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
Chris Williams
Top achievements
Rank 1
answered on 28 Oct 2011, 06:13 PM
Oh, I'm so stupid!  thank you.
Tags
TabStrip
Asked by
Chris Williams
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Chris Williams
Top achievements
Rank 1
Share this question
or