DataGrid can not search fields

I am having an issue with the DataGrid and the intrinsic search fields. I am using AllowVirtualization="true" and using Type="typeof(string)". The any search causes this error:

blazor.server.js:19 [2021-07-29T22:09:03.252Z] Error: No property or field 'Logs' exists in type 'Logs' (at index 2)

This is the basic configuration:

@inject logContext logdb;

<RadzenCard Style=@string.Concat("height: 600px; width: 99%; background-color:linen; padding: 5px;", context.isLoadingStyle)>
	<RadzenDataGrid  Data="@evLog"  IsLoading="@isLoading" Count="@count" PageSize="50" TItem="Logs" @ref="evGrid" 
					RowRender="@RowRender" CellRender="@CellRender" AllowVirtualization="true" AllowFiltering="true" 
					FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive" LogicalFilterOperator="LogicalFilterOperator.Or" 
					AllowPaging="false" AllowSorting="true" Style="line-height: 14px; width:100%; height: 585px; margin-right:5px;" Type="typeof(Date)">
		<Columns>
			@*Main Grid View*@
			<RadzenDataGridColumn Width="75px" TItem="Logs" Property="Logs.Timestamp" Title="Time Stamp" TextAlign="TextAlign.Left" />
			<RadzenDataGridColumn Width="60px" TItem="string" Visible="@ShowIPColumn" Property="@IPAddress" Title="IP Adress" TextAlign="TextAlign.Left" Type="typeof(string)" />
			<RadzenDataGridColumn Width="100px" TItem="Logs" Property="Logs.SourceContext" Title="Source Context" TextAlign="TextAlign.Center" Type="typeof(string)" />
			<RadzenDataGridColumn Width="100px" TItem="Logs" Property="Logs.Level" Title="Level" TextAlign="TextAlign.Center" Type="typeof(string)" />
			<RadzenDataGridColumn Width="600px" TItem="Logs" Property="Logs.Message" Title="Message" TextAlign="TextAlign.Left" Type="typeof(string)">
				<Template Context="logs">
					<RadzenImage Path=@GetIconPath(logs) Style="width:12px; height:12px" />
					@((MarkupString)GetMessageSpan(logs))
				</Template>
			</RadzenDataGridColumn>
		</Columns>
		@*Style="line-height: 12px; width: 99%;"> <--- This can go back in the next Radzen release, current ver: 2.10.5 Now fixed in 2.10.13 https://forum.radzen.com/t/datagrid-style-not-working-as-expected/4009 *@
		<Template Context="logItem">
			@*Expanded grid*@
			<RadzenDataGrid Data="@GetLogItem(logItem)" TItem="Logs" CellRender="@ItemCellRender" AllowPaging="false" AllowSorting="false" AllowFiltering="false">
				<Columns>
					<RadzenDataGridColumn Width="600px" TItem="Logs" Property="log.Message" Type="typeof(string)">
						<Template Context="logMessage">
							@((MarkupString)GetExpandText(logMessage, true))
						</Template>
					</RadzenDataGridColumn>
				</Columns>
			</RadzenDataGrid>
		</Template>
	</RadzenDataGrid>
</RadzenCard>
			
@code {
	
    IEnumerable<Logs> evLog;
    RadzenDataGrid<Logs> evGrid;
		
		
	// Logs is an entity class consisting of the grid fields
	
	protected override void OnInitialized()
    {
        evLog = logdb.Logs.OrderByDescending(Logs => Logs.Timestamp);
    }
	
	
	private string GetMessageSpan(Logs log)
    {
        context.IsLoading = true;
        try
        {
            bool expand = false;
            string retMsg = string.Empty;
            string color = "black";
            string fontSize = "12px";
            string retStr = string.Empty;
	
			// some formatting code
	
	        retStr += $"<span style='color:{color}; font-size:{fontSize}; white-space:pre-wrap'>{retMsg}</span>";
            context.IsLoading = false;
            return retStr;
        }
	
	
	private string GetExpandText(Logs log, bool expand)
    {
        context.IsLoading = true;
        string retMsg = string.Empty;
        string color = "black";
        string fontSize = "12px";
        string retStr = string.Empty;
	
		// some formatting code
	
	    retStr += $"<span style='color:{color}; font-size:{fontSize}; white-space:pre-wrap'>{retMsg}</span>";
        context.IsLoading = false;
        return retStr;
    }
	
}

Class Logs:

Public Class Logs
    Public Overridable Property id As Integer
    Public Overridable Property Timestamp As DateTime
    <StringLength(50)> Public Overridable Property Level As String
    <StringLength(50)> Public Overridable Property Template As String
    <StringLength(4096)> Public Overridable Property Message As String
    <StringLength(4096)> Public Overridable Property Exception As String
    <StringLength(4096)> Public Overridable Property Properties As String
    <StringLength(50)> Public Overridable Property SourceContext As String
    <StringLength(50)> Public Overridable Property groupExpanded As String
    <StringLength(50)> Public Overridable Property groupCollapsed As String
    <StringLength(50)> Public Overridable Property ActionId As String
    <StringLength(50)> Public Overridable Property Link As String
    <StringLength(50)> Public Overridable Property Node As String
    <StringLength(50)> Public Overridable Property FRM As String
    <StringLength(50)> Public Overridable Property UserName As String

    <DatabaseGenerated(DatabaseGeneratedOption.Computed)>
    Public Overridable Property _ts As DateTime
End Class

Logs is an entity framework class of the grids fields.

Thank you for any help with this. I do have a subscription.

Regards,
Orlando Davis

Not sure why this is string while the rest of the columns is TItem="Logs". This is the type of the item of the collection bound to the grid and should be the same for all columns and the DataGrid itself.

Not sure also what’s the purpose of this DataGrid setting

Hello and thank you for your response.

The "IPAddress" field was added as a code generated field and not part of the Logs entity. The rest of the fields are part of the Logs entity class. I will comment out this column for now.

Typeof"Date" was a mistake. Too many cut and paste's. I was originally using the regular grid and had to change the column types. Thank you for pointing this out.

Correcting those two items does not fix this issue however. And still get:

Error: No property or field 'Logs' exists in type 'Logs' (at index 2)

Thank you for your responses.
Orlando

You need to set Property to the name of the property e.g.

<RadzenDataGridColumn Width="75px" TItem="Logs" Property="Timestamp" Title="Time Stamp" TextAlign="TextAlign.Left" />
			

Ughh! That was so obvious - can't believe I missed that. Thank you very much, that worked.

Regards,
Orlando

One last question, If you filter on a column and get results then filter further on those results, the 2nd filter is not based on the first filter. Is there anyway of keeping the first filter and then applying a 2nd filter to those results?

An example would be filter the time stamp column for a single date then filter the message column for that date only. It looks like that should work but doesn't.

Fixed with changing to LogicalFilterOperator="LogicalFilterOperator.And"

My Bad, sorry it seems you need to set "LogicalFilterOperator="LogicalFilterOperator.And"" to "And" instead of "Or" and the filters work with the resulting dataset.

The date still seems to not filter quite right as shown in the below screen shot. There are valid entries for the 27th and 29th as well.

Regards,
Orlando

Well it seems this is what your database returns for the given filter. You can inspect the SQL queries that are generated via SQL profiler.

Hello,

It seems you are correct, this MariaDB and there is certainly an issue with dates going on. Thank you for your input.

Regards,
Orlando