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

[Solved] Binding to Model Content doesn't set in Razor

0 Answers 28 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.
Saul
Top achievements
Rank 1
Saul asked on 23 Nov 2011, 03:42 PM
I have a model with HTML content and I'm trying to bind my Tabstrip to this model and set content but it throws errors. I've tried many different variations of item.Content setting but none of them work. 

The line:
item.Content = () => Tab.Content;
gives an error:
Only assignment, call, increment, decrement, and new object expressions can be used as a statement

The line:
item.Content = Tab.Content;
gives an error:
Cannot implicitly convert type 'string' to 'System.Action'


Is there a way to set content directly and not going to Action?


Here is my code:



@{ Html.Telerik().TabStrip()
        .Name("TabStrip")
        .SelectedIndex(0)
        .BindTo(Model, (item, Tab) =>
        {
            item.Text = Tab.Name;
            item.Content = Tab.Content;


        })
        .Render();




public class Tab : BaseMenu
    {
        public string Name { get; set; }
        public string Content { get; set; }


    }


Tags
TabStrip
Asked by
Saul
Top achievements
Rank 1
Share this question
or