Skip to content

quest(Table): 在EditTemplate 中使用 SelectTable 如果使用 @bind-Value=XXX 报错 #6616

@yc-2503

Description

@yc-2503

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

双向绑定时报错,不双向绑定是正常的。抛的异常:

BootstrapBlazor.Components.BootstrapBlazorErrorBoundary[0]
      BootstrapBlazorErrorBoundary OnErrorAsync log this error occurred at http://localhost:5225/technology-setup
      System.ArgumentNullException: Value cannot be null. (Parameter 'element')
         at System.ArgumentNullException.Throw(String paramName)
         at System.Attribute.GetCustomAttributes(MemberInfo element, Type attributeType, Boolean inherit)
         at System.Reflection.CustomAttributeExtensions.GetCustomAttribute[T](MemberInfo element, Boolean inherit)
         at BootstrapBlazor.Components.ValidateBase`1.IsRequired()
         at BootstrapBlazor.Components.ValidateBase`1.OnParametersSet()
         at BootstrapBlazor.Components.SelectTable`1.OnParametersSet()
         at Microsoft.AspNetCore.Components.ComponentBase.CallOnParametersSetAsync()
         at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()

ValidateBase.cs 的 IsRequired() 方法报的错。

我的使用场景是自定义一个Table 的编辑菜单,因为有个下拉框内容比较多,想利用SelectTable 的分页特性,所以在自定义的Table 编辑模板中使用了 SeletTable 。 但是Table 的编辑模板似乎会让 SeletTable 走 ValidateForm 的逻辑,但是我又没有 ValidateForm 中的 Model。

Expected Behavior

Table 组件中,在自定义 EditTemplate 中可以正常使用 SelectTable

Interactive render mode

Interactive Server (Interactive server-side rendering (interactive SSR) using Blazor Server)

Steps To Reproduce

1、创建一个 Table
2、Table 的 EditTemplate 使用自定义组件
3、自定义组件中使用SelectTable

Exceptions (if any)

No response

.NET Version

NET9.0

Anything else?

BootstrapBlazorApp6.zip

Metadata

Metadata

Assignees

Labels

questionQuestion that needs to be answered

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions