I am trying to bind a TextBox to an a dynamically named column using expressions.
var textBoxHistorical =
new
TextBox
{
Name =
"myTextBox"
,
Value =
"= Fields.["
+ dynamicColumnName+
"_Average])"
,
Size =
new
SizeU(Unit.Pixel(100), Unit.Pixel(20)),
Location =
new
PointU(Unit.Pixel(0), Unit.Pixel(0))
};
The column name can have ugly characters like \/*[]:?|-+@#$$^&()_,.!3. When I try to bind to Fields.[\/*[]:?|-+@#$$^&()_,.!3_Average], I get an error like
Cannot interpret token '\' at position 13.
I tried escaping the slash with another slash, and got the same error. How do I escape characters in an expression? Which characters do I need to escape? I figure I need to escape the closing bracket also, but trial by error is probably not the best way to solve the problem.