This question is locked. New answers and comments are not allowed.
Hello
I'm using the Q1 2010 of Telerik controls for ASP .Net MVC and stuck with next when on adding columns to grid:
Following code worked in Q3 2009 version (I have removed such things as Encoded(false) in samples):
With Q1 version that code I've changed first to:
but got telerik exception "Bound columns require a field or property access expression."
And after that changed to template:
but get compile error: "Only assignment, call, increment, decrement and new object expressions can be used as a statement"
I think that it is possible to wrap that condition to the html helper and return only string - something like this:
but this is very simple example and in more complex cases there will be many helpers with functionality where hardly to understand there difference.
So the question: Is it possible to work with column.Template(...) where between parenthesis present not a string but expression which returns string (see examples above)?
Thanks
I'm using the Q1 2010 of Telerik controls for ASP .Net MVC and stuck with next when on adding columns to grid:
Following code worked in Q3 2009 version (I have removed such things as Encoded(false) in samples):
columns.Add ( s => String.IsNullOrEmpty ( s.StringVar1 ) |
? s.StringVar2 |
: Html.ActionLink<SomeController> ( x => x.Title ( s.Var3 ), s.StringVar1, null ) ); |
With Q1 version that code I've changed first to:
columns.Bound ( s => String.IsNullOrEmpty ( s.StringVar1 ) |
? s.StringVar2 |
: Html.ActionLink<SomeController> ( x => x.Title ( s.Var3 ), s.StringVar1, null ) ); |
but got telerik exception "Bound columns require a field or property access expression."
And after that changed to template:
columns.Template ( s => String.IsNullOrEmpty ( s.StringVar1 ) |
? s.StringVar2 |
: Html.ActionLink<SomeController> ( x => x.Title ( s.Var3 ), s.StringVar1, null ) ); |
but get compile error: "Only assignment, call, increment, decrement and new object expressions can be used as a statement"
I think that it is possible to wrap that condition to the html helper and return only string - something like this:
columns.Template ( Html.MyWrapHelper<SomeController> ( x => x.Title ( s.Var3 ), s.StringVar1, null ) ); |
but this is very simple example and in more complex cases there will be many helpers with functionality where hardly to understand there difference.
So the question: Is it possible to work with column.Template(...) where between parenthesis present not a string but expression which returns string (see examples above)?
Thanks