Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Blazor服务器端InputSelect用于字节数据类型,onChange事件错误_C#_Asp.net Core_Blazor_Blazor Server Side_Asp.net Core 3.1 - Fatal编程技术网

C# Blazor服务器端InputSelect用于字节数据类型,onChange事件错误

C# Blazor服务器端InputSelect用于字节数据类型,onChange事件错误,c#,asp.net-core,blazor,blazor-server-side,asp.net-core-3.1,C#,Asp.net Core,Blazor,Blazor Server Side,Asp.net Core 3.1,我使用的是ASP.NETCore3.1,Blazor服务器端。我在 @page”/add_文件集 @注入Foo.Data.ApplicationDbContext数据库 Tên文件: Mứcưu tièn: @**@ 中国ọN Rấ丁泉ọng 全trọng Bình thường Ít quan trọng 蒙特勒ạ吴塔伊: @* 瞧ại hồ sơ *@ 卢 @代码{ 公共类AddFiletSetPageModel { 公共字符串文件名{get;set;} 公共十进制?创建者ID{get;se

我使用的是ASP.NETCore3.1,Blazor服务器端。我在

@page”/add_文件集
@注入Foo.Data.ApplicationDbContext数据库
Tên文件:
Mứcưu tièn:
@**@
中国ọN
Rấ丁泉ọng
全trọng
Bình thường
Ít quan trọng
蒙特勒ạ吴塔伊:
@*
瞧ại hồ sơ
*@
卢
@代码{
公共类AddFiletSetPageModel
{
公共字符串文件名{get;set;}
公共十进制?创建者ID{get;set;}
公共日期时间?已创建{get;set;}
公共小数?ModifierId{get;set;}
公共日期时间?已修改{get;set;}
公共字节?PriorityLevel{get;set;}
公共字节?状态码{get;set;}
}
私有AddFiletSetPageModel=新的AddFiletSetPageModel();
私人无效手册提交()
{
FileSet fileItem=新文件集
{
FileName=model.FileName,
CreatorId=model.CreatorId,
Created=DateTime。现在,
PriorityLevel=model.PriorityLevel,
StatusCode=model.StatusCode
};
Db.FileSet.Add(fileItem);
Db.SaveChanges();
}
}

关注这些代码行

<InputSelect id="PriorityLevel" @bind-Value="model.PriorityLevel" class="form-control">
    <option>Chọn...</option>
    <option value=1>Rất quan trọng</option>
    <option value=2>Quan trọng</option>
    <option value=3>Bình thường</option>
    <option value=4>Ít quan trọng</option>
</InputSelect>

中国ọN
Rấ丁泉ọng
全trọng
Bình thường
Ít quan trọng
单击下拉列表时,控制台出现错误

[2019-12-27T08:58:22.819Z] Error: System.InvalidOperationException: Microsoft.AspNetCore.Components.Forms.InputSelect`1[System.Nullable`1[System.Byte]] does not support the type 'System.Nullable`1[System.Byte]'.

   at Microsoft.AspNetCore.Components.Forms.InputSelect`1.TryParseValueFromString(String value, TValue& result, String& validationErrorMessage)

   at Microsoft.AspNetCore.Components.Forms.InputBase`1.set_CurrentValueAsString(String value)

   at Microsoft.AspNetCore.Components.Forms.InputSelect`1.<BuildRenderTree>b__4_0(String __value)

   at Microsoft.AspNetCore.Components.EventCallbackFactoryBinderExtensions.<>c__DisplayClass22_0`1.<CreateBinderCore>b__0(ChangeEventArgs e)

--- End of stack trace from previous location where exception was thrown ---

   at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)

   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle) blazor.server.js:15:27309
    log https://localhost:44348/_framework/blazor.server.js:15
    C https://localhost:44348/_framework/blazor.server.js:8
    S https://localhost:44348/_framework/blazor.server.js:8
    invokeClientMethod https://localhost:44348/_framework/blazor.server.js:1
    invokeClientMethod https://localhost:44348/_framework/blazor.server.js:1
    processIncomingData https://localhost:44348/_framework/blazor.server.js:1
    onreceive https://localhost:44348/_framework/blazor.server.js:1
    onmessage https://localhost:44348/_framework/blazor.server.js:1
    (Async: EventHandlerNonNull)
    connect https://localhost:44348/_framework/blazor.server.js:1
    connect https://localhost:44348/_framework/blazor.server.js:1
    s https://localhost:44348/_framework/blazor.server.js:1
    s https://localhost:44348/_framework/blazor.server.js:1
    L https://localhost:44348/_framework/blazor.server.js:1
    L https://localhost:44348/_framework/blazor.server.js:1
    connect https://localhost:44348/_framework/blazor.server.js:1
    startTransport https://localhost:44348/_framework/blazor.server.js:1
    createTransport https://localhost:44348/_framework/blazor.server.js:1
    s https://localhost:44348/_framework/blazor.server.js:1
    s https://localhost:44348/_framework/blazor.server.js:1
    B https://localhost:44348/_framework/blazor.server.js:1
    B https://localhost:44348/_framework/blazor.server.js:1
    createTransport https://localhost:44348/_framework/blazor.server.js:1
    startInternal https://localhost:44348/_framework/blazor.server.js:1
    s https://localhost:44348/_framework/blazor.server.js:1
    s https://localhost:44348/_framework/blazor.server.js:1
    a https://localhost:44348/_framework/blazor.server.js:1
    (Async: promise callback)
    c https://localhost:44348/_framework/blazor.server.js:1
    B https://localhost:44348/_framework/blazor.server.js:1
    B https://localhost:44348/_framework/blazor.server.js:1
    startInternal https://localhost:44348/_framework/blazor.server.js:1
    start https://localhost:44348/_framework/blazor.server.js:1
    s https://localhost:44348/_framework/blazor.server.js:1
    s https://localhost:44348/_framework/blazor.server.js:1
    B https://localhost:44348/_framework/blazor.server.js:1
    B https://localhost:44348/_framework/blazor.server.js:1
    start https://localhost:44348/_framework/blazor.server.js:1
    startInternal https://localhost:44348/_framework/blazor.server.js:1
    s https://localhost:44348/_framework/blazor.server.js:1
    s https://localhost:44348/_framework/blazor.server.js:1
    v https://localhost:44348/_framework/blazor.server.js:1
    v https://localhost:44348/_framework/blazor.server.js:1
    startInternal https://localhost:44348/_framework/blazor.server.js:1
    startWithStateTransitions https://localhost:44348/_framework/blazor.server.js:1
    s https://localhost:44348/_framework/blazor.server.js:1
    s https://localhost:44348/_framework/blazor.server.js:1
    v https://localhost:44348/_framework/blazor.server.js:1
    v https://localhost:44348/_framework/blazor.server.js:1
    startWithStateTransitions https://localhost:44348/_framework/blazor.server.js:1
    start https://localhost:44348/_framework/blazor.server.js:1
    S https://localhost:44348/_framework/blazor.server.js:8
    s https://localhost:44348/_framework/blazor.server.js:8
    s https://localhost:44348/_framework/blazor.server.js:8
    r https://localhost:44348/_framework/blazor.server.js:8
    r https://localhost:44348/_framework/blazor.server.js:8
    S https://localhost:44348/_framework/blazor.server.js:8
    E https://localhost:44348/_framework/blazor.server.js:8
    s https://localhost:44348/_framework/blazor.server.js:8
    s https://localhost:44348/_framework/blazor.server.js:8
    r https://localhost:44348/_framework/blazor.server.js:8
    r https://localhost:44348/_framework/blazor.server.js:8
    E https://localhost:44348/_framework/blazor.server.js:8
    <anonymous> https://localhost:44348/_framework/blazor.server.js:8
    n https://localhost:44348/_framework/blazor.server.js:1
    <anonymous> https://localhost:44348/_framework/blazor.server.js:1
    <anonymous> https://localhost:44348/_framework/blazor.server.js:1
[2019-12-27T08:58:22.819Z]错误:System.InvalidOperationException:Microsoft.AspNetCore.Components.Forms.InputSelect`1[System.Nullable`1[System.Byte]]不支持类型“System.Nullable`1[System.Byte]”。
在Microsoft.AspNetCore.Components.Forms.InputSelect`1.TryParseValueFromString(字符串值、TValue和结果、字符串和验证错误消息)
在Microsoft.AspNetCore.Components.Forms.InputBase`1.set\u CurrentValueAsString(字符串值)中
在Microsoft.AspNetCore.Components.Forms.InputSelect`1.b_uuu4_0(字符串值)
在Microsoft.AspNetCore.Components.EventCallbackFactoryBinderExtensions.c__显示类22_0`1.b__0(ChangeEventArgs e)
---来自引发异常的上一个位置的堆栈结束跟踪---
位于Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(任务)
位于Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(TaskTaskToHandle)blazor.server.js:15:27309
日志https://localhost:44348/_framework/blazor.server.js:15
Chttps://localhost:44348/_framework/blazor.server.js:8
shttps://localhost:44348/_framework/blazor.server.js:8
invokeClientMethodhttps://localhost:44348/_framework/blazor.server.js:1
invokeClientMethodhttps://localhost:44348/_framework/blazor.server.js:1
处理输入数据https://localhost:44348/_framework/blazor.server.js:1
收到https://localhost:44348/_framework/blazor.server.js:1
onmessagehttps://localhost:44348/_framework/blazor.server.js:1
(异步:EventHandlerNonNull)
连接https://localhost:44348/_framework/blazor.server.js:1
连接https://localhost:44348/_framework/blazor.server.js:1
shttps://localhost:44348/_framework/blazor.server.js:1
shttps://localhost:44348/_framework/blazor.server.js:1
Lhttps://localhost:44348/_framework/blazor.server.js:1
Lhttps://localhost:44348/_framework/blazor.server.js:1
连接https://localhost:44348/_framework/blazor.server.js:1
startTransporthttps://localhost:44348/_framework/blazor.server.js:1
createTransporthttps://localhost:44348/_framework/blazor.server.js:1
shttps://localhost:44348/_framework/blazor.server.js:1
shttps://localhost:44348/_framework/blazor.server.js:1
Bhttps://localhost:44348/_framework/blazor.server.js:1
Bhttps://localhost:44348/_framework/blazor.server.js:1
createTransporthttps://localhost:44348/_framework/blazor.server.js:1
星形内部https://localhost:44348/_framework/blazor.server.js:1
shttps://localhost:44348/_framework/blazor.server.js:1
shttps://localhost:44348/_framework/blazor.server.js:1
A.https://localhost:44348/_framework/blazor.server.js:1
(异步:承诺回调)
Chttps://localhost:44348/_framework/blazor.server.js:1
Bhttps://localhost:44348/_framework/blazor.server.js:1
Bhttps://localhost:44348/_framework/blazor.server.js:1
星形内部https://localhost:44348/_framework/blazor.server.js:1
开始https://localhost:44348/_framework/blazor.server.js:1
shttps://localhost:44348/_framework/blazor.server.js:1
shttps://localhost:44348/_framework/blazor.server.js:1
Bhttps://localhost:44348/_framework/blazor.server.js:1
Bhttps://localhost:44348/_framework/blazor.server.js:1
开始https://localhost:44348/_framework/blazor.server.js:1
星形内部https://localhost:44348/_framework/blazor.server.js:1
shttps://localhost:44348/_framework/blazor.server.js:1
shttps://localhost:44348/_framework/blazor.server.js:1
vhttps://localhost:44348/_framework/blazor.server.js:1
vhttps://localhost:44348/_framework/blazor.server.js:1
星形内部https://localhost:44348/_framework/blazor.server.js:1
startwithstate转换https://localhost:44348/_framework/blazor.server.js:1
shttps://localhost:44348/_framework/blazor.server.js:1
shttps://localhost:44348/_framework/blazor.server.js:1
vhttps://localhost:44348/_framework/blazor.server.js:1
vhttps://localhost:44348/_framework/blazor.server.js:1
startwithstate转换https://localhost:44348/_fr
[2019-12-27T08:58:22.819Z] Error: System.InvalidOperationException: Microsoft.AspNetCore.Components.Forms.InputSelect`1[System.Nullable`1[System.Byte]] does not support the type 'System.Nullable`1[System.Byte]'.

   at Microsoft.AspNetCore.Components.Forms.InputSelect`1.TryParseValueFromString(String value, TValue& result, String& validationErrorMessage)

   at Microsoft.AspNetCore.Components.Forms.InputBase`1.set_CurrentValueAsString(String value)

   at Microsoft.AspNetCore.Components.Forms.InputSelect`1.<BuildRenderTree>b__4_0(String __value)

   at Microsoft.AspNetCore.Components.EventCallbackFactoryBinderExtensions.<>c__DisplayClass22_0`1.<CreateBinderCore>b__0(ChangeEventArgs e)

--- End of stack trace from previous location where exception was thrown ---

   at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)

   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle) blazor.server.js:15:27309
    log https://localhost:44348/_framework/blazor.server.js:15
    C https://localhost:44348/_framework/blazor.server.js:8
    S https://localhost:44348/_framework/blazor.server.js:8
    invokeClientMethod https://localhost:44348/_framework/blazor.server.js:1
    invokeClientMethod https://localhost:44348/_framework/blazor.server.js:1
    processIncomingData https://localhost:44348/_framework/blazor.server.js:1
    onreceive https://localhost:44348/_framework/blazor.server.js:1
    onmessage https://localhost:44348/_framework/blazor.server.js:1
    (Async: EventHandlerNonNull)
    connect https://localhost:44348/_framework/blazor.server.js:1
    connect https://localhost:44348/_framework/blazor.server.js:1
    s https://localhost:44348/_framework/blazor.server.js:1
    s https://localhost:44348/_framework/blazor.server.js:1
    L https://localhost:44348/_framework/blazor.server.js:1
    L https://localhost:44348/_framework/blazor.server.js:1
    connect https://localhost:44348/_framework/blazor.server.js:1
    startTransport https://localhost:44348/_framework/blazor.server.js:1
    createTransport https://localhost:44348/_framework/blazor.server.js:1
    s https://localhost:44348/_framework/blazor.server.js:1
    s https://localhost:44348/_framework/blazor.server.js:1
    B https://localhost:44348/_framework/blazor.server.js:1
    B https://localhost:44348/_framework/blazor.server.js:1
    createTransport https://localhost:44348/_framework/blazor.server.js:1
    startInternal https://localhost:44348/_framework/blazor.server.js:1
    s https://localhost:44348/_framework/blazor.server.js:1
    s https://localhost:44348/_framework/blazor.server.js:1
    a https://localhost:44348/_framework/blazor.server.js:1
    (Async: promise callback)
    c https://localhost:44348/_framework/blazor.server.js:1
    B https://localhost:44348/_framework/blazor.server.js:1
    B https://localhost:44348/_framework/blazor.server.js:1
    startInternal https://localhost:44348/_framework/blazor.server.js:1
    start https://localhost:44348/_framework/blazor.server.js:1
    s https://localhost:44348/_framework/blazor.server.js:1
    s https://localhost:44348/_framework/blazor.server.js:1
    B https://localhost:44348/_framework/blazor.server.js:1
    B https://localhost:44348/_framework/blazor.server.js:1
    start https://localhost:44348/_framework/blazor.server.js:1
    startInternal https://localhost:44348/_framework/blazor.server.js:1
    s https://localhost:44348/_framework/blazor.server.js:1
    s https://localhost:44348/_framework/blazor.server.js:1
    v https://localhost:44348/_framework/blazor.server.js:1
    v https://localhost:44348/_framework/blazor.server.js:1
    startInternal https://localhost:44348/_framework/blazor.server.js:1
    startWithStateTransitions https://localhost:44348/_framework/blazor.server.js:1
    s https://localhost:44348/_framework/blazor.server.js:1
    s https://localhost:44348/_framework/blazor.server.js:1
    v https://localhost:44348/_framework/blazor.server.js:1
    v https://localhost:44348/_framework/blazor.server.js:1
    startWithStateTransitions https://localhost:44348/_framework/blazor.server.js:1
    start https://localhost:44348/_framework/blazor.server.js:1
    S https://localhost:44348/_framework/blazor.server.js:8
    s https://localhost:44348/_framework/blazor.server.js:8
    s https://localhost:44348/_framework/blazor.server.js:8
    r https://localhost:44348/_framework/blazor.server.js:8
    r https://localhost:44348/_framework/blazor.server.js:8
    S https://localhost:44348/_framework/blazor.server.js:8
    E https://localhost:44348/_framework/blazor.server.js:8
    s https://localhost:44348/_framework/blazor.server.js:8
    s https://localhost:44348/_framework/blazor.server.js:8
    r https://localhost:44348/_framework/blazor.server.js:8
    r https://localhost:44348/_framework/blazor.server.js:8
    E https://localhost:44348/_framework/blazor.server.js:8
    <anonymous> https://localhost:44348/_framework/blazor.server.js:8
    n https://localhost:44348/_framework/blazor.server.js:1
    <anonymous> https://localhost:44348/_framework/blazor.server.js:1
    <anonymous> https://localhost:44348/_framework/blazor.server.js:1