I have a hierarchy Grid. The child grid has complex values used to define the columns. I need to do a conditional when defining what to display in the "Value" column. "Value" is of type NotificationEventConditionValueViewModel, which is defined as:
public class NotificationEventConditionValueViewModel
{
public string ValueString { get; set; }
public System.DateTime ValueDate { get; set; }
public bool ValueBoolean { get; set; }
}
In my child grid I am trying to do a conditional based on the type of Value, something like the following:
columns.Bound(e => e.Value).Title("Value").ClientTemplate("\\#if(NotificationEventConditionField.FieldType.Id == 5){\\#=Value.ValueBoolean\\#}else{\\#=Value.ValueString\\#}\\#").Width(80).HeaderHtmlAttributes(new { style = "font-weight: bold;text-decoration: underline;" });
The
"\\#if(NotificationEventConditionField.FieldType.Id == 5) evaluates fine, but the
{\\#=Value.ValueBoolean\\#} does not show the value I want, instead it show the string: #=Value.ValueBoolean.
Can you please help me to determine what I am doing wrong in the syntax. I am attaching some files. In the COnfigure.cshtml look for Grid "UDEGrid_#=Id#" which is the child grid, and Grid "notificationGridUDE" which is the parent grid. A am also attaching the view models.
Thank yoy very much in advance.
public class NotificationEventConditionValueViewModel
{
public string ValueString { get; set; }
public System.DateTime ValueDate { get; set; }
public bool ValueBoolean { get; set; }
}
In my child grid I am trying to do a conditional based on the type of Value, something like the following:
columns.Bound(e => e.Value).Title("Value").ClientTemplate("\\#if(NotificationEventConditionField.FieldType.Id == 5){\\#=Value.ValueBoolean\\#}else{\\#=Value.ValueString\\#}\\#").Width(80).HeaderHtmlAttributes(new { style = "font-weight: bold;text-decoration: underline;" });
The
"\\#if(NotificationEventConditionField.FieldType.Id == 5) evaluates fine, but the
{\\#=Value.ValueBoolean\\#} does not show the value I want, instead it show the string: #=Value.ValueBoolean.
Can you please help me to determine what I am doing wrong in the syntax. I am attaching some files. In the COnfigure.cshtml look for Grid "UDEGrid_#=Id#" which is the child grid, and Grid "notificationGridUDE" which is the parent grid. A am also attaching the view models.
Thank yoy very much in advance.