C# 清除textbox后,Blazor Blazored.Typeahead组件引发异常
嗨,我试图解决这个问题有一段时间了,但似乎没有任何效果 我已经在我的项目中使用了BazloredTypeahead组件。我从我的模型中投标对象,并使用模板获得对象字符串表示 以下是我的代码的一些表示:C# 清除textbox后,Blazor Blazored.Typeahead组件引发异常,c#,asp.net-core,web-applications,blazor,blazored,C#,Asp.net Core,Web Applications,Blazor,Blazored,嗨,我试图解决这个问题有一段时间了,但似乎没有任何效果 我已经在我的项目中使用了BazloredTypeahead组件。我从我的模型中投标对象,并使用模板获得对象字符串表示 以下是我的代码的一些表示: @if(ClientList!=null&&ClientList.Any()) { @template.GetAutocompleteValue() @template.GetAutocompleteValue() 找不到客户端 } 这个组件有一个默认的清晰图标,每次我点击它,我都会得到这个
@if(ClientList!=null&&ClientList.Any())
{
@template.GetAutocompleteValue()
@template.GetAutocompleteValue()
找不到客户端
}
这个组件有一个默认的清晰图标,每次我点击它,我都会得到这个异常
错误:System.ArgumentNullException:值不能为null。(参数“模型”)
位于Microsoft.AspNetCore.Components.Forms.FieldIdentifier..ctor(对象模型,字符串字段名)
在Microsoft.AspNetCore.Components.Forms.FieldIdentifier.Create[TField](表达式'1访问器)中
在Microsoft.AspNetCore.Components.Forms.ValidationMessage`1.OnParametersSet()中
在Microsoft.AspNetCore.Components.ComponentBase.CallOnParametersSetAsync()中
位于Microsoft.AspNetCore.Components.ComponentBase.SetParametersAsync(ParameterView参数)
位于Microsoft.AspNetCore.Components.Rendering.ComponentState.SetDirectParameters(ParameterView参数)
位于Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.UpdateRetainedChildComponent(DiffContext&DiffContext,Int32 oldComponentIndex,Int32 newComponentIndex)
在Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForFramesWithSameSequence(DiffContext&DiffContext、Int32 oldFrameIndex、Int32 newFrameIndex)中
位于Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForRange(DiffContext&DiffContext,Int32 oldStartIndex,Int32 OldEndIndexCcl,Int32 newStartIndex,Int32 NewEndIndexCcl)
在Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForFramesWithSameSequence(DiffContext&DiffContext、Int32 oldFrameIndex、Int32 newFrameIndex)中
位于Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForRange(DiffContext&DiffContext,Int32 oldStartIndex,Int32 OldEndIndexCcl,Int32 newStartIndex,Int32 NewEndIndexCcl)
位于Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.ComputeDiff(渲染器渲染器、RenderBatchBuilder、Int32 componentId、ArrayRange`1 oldTree、ArrayRange`1 newTree)
在Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder、RenderFragment和RenderFragment)中
位于Microsoft.AspNetCore.Components.RenderTree.Renderer.RenderInExistingBatch(RenderQueueEntry RenderQueueEntry)
在Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()中
e、 log@blazor.server.js:19
我确信我的对象最初不是空的
我的GetAutocompleteValue方法:
公共静态字符串GetAutocompleteValue(此客户端)
{
返回client==null?string.Empty:$“{client.FirstName}{client.LastName}-{client.PhoneNumber}”;
}
所以在我点击“X”之前,一切都正常。我在不同的组件()上遇到了相同的问题,但似乎例外情况如下:(我将通知任何帮助。我找到了解决方案并对其进行了描述我找到了解决方案并对其进行了描述