So I want make a component that encapsulates your grid column component and then drive the look from a database table (aka width and type).
for numeric columns I want to align right .
The problem is that the type of object is not known so i cannot cast it like you have done in your right align template example code.
Is there a way to get the reference field value into the template and not just the bound record object (aka context).
or of course is there a better way to do this ??
Any help would be appreciated.
@switch ((Dashboard.Enums.EColumnType)GridViewColumn.ColumnType)
{
case Enums.EColumnType.Numeric:
<
GridColumn
Field
=
"@GridViewColumn.FieldName"
Title
=
"@GridViewColumn.HeaderText"
Width
=
"@GridViewColumn.Width"
>
<
Template
>
<
div
style
=
"text-align: right;"
>
@((context as data).TargetProperty)
</
div
>
</
Template
>
</
GridColumn
>
break;
case Enums.EColumnType.Currency:
break;
case Enums.EColumnType.Percentage:
break;
default:
<
GridColumn
Field
=
"@GridViewColumn.FieldName"
Title
=
"@GridViewColumn.HeaderText"
Width
=
"@GridViewColumn.Width"
/>
break;
}
@code {
[Parameter]
public GridViewColumn GridViewColumn { get; set; }
}