Ok so I just typed "string.startsWith(string)" as an expression and it worked... very cool.
Is there a list of all options for expressions?
I didn't see .startsWith() in any of your documents.
0
Accepted
Yavor Georgiev
Telerik team
answered on 28 Jul 2011, 09:43 AM
Hello Zack,
All the functions in RadExpressionEditor's runtime are actual CLR methods, which have just been exposed in a list to make them easily discoverable for end-users. However, as every value in the RadExpressionEditor's expression is an actual CLR object, you can also call .Net methods, not only the predefined functions.
In short, when you enter a function call expression in RadExpressionEditor, the engine tries to resolve the function from all the methods in the type of the function call operand. So when you type "myField.StartsWith("bla")", it tries to call the StartsWith method of the type of the "myField" field, which is System.String.
Tl;dr version: even though a method or property is not exposed in RadExpressionEditor's list of available items, you can still call it in the expression, provided that the CLR type you are calling it on actually contains it.
Regards,
Yavor Georgiev
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!
For end users, they don't know what they can use other than the predefined functions list in the expression editor so we may consider just making a simple additional list below the editor to give them instruction on using certain methods like .startsWith() if we know they will be resolved. Maybe we filter its contents by the field type they have selected in the editor.