I have web page and My web page is left without any reaction after the website is launched and the page is locked. Codes are as bellow:
@attribute [Authorize]
@inject IReciption _Reception;
<section >
<div >
<div >
<div >
<div >
<div >
<h3>Reception</h3>
@*<h3>RegReception<InfoBoxComponent StrMessage="@Message1"></InfoBoxComponent></h3>*@
</div>
<div >
<div >
<ul>
<li>
<div>
<input type="text" @bind-value="@StrSerialNumber" placeholder="SerialNumber">
</div>
</li>
<li>
@if (!IsSaveLoading)
{
<button @onclick="(() => CheckTheSerial())" style="margin-top:15px;">Testing</button>
}
else
{
<button style="margin-top:15px;">
<i ></i> Searching
</button>
}
</li>
@if (prodSrCls.Responses.Statue != LosacoWeb.Shared.Enumes.StatueResponse.NoStatus)
{
@if (prodSrCls.Responses.Statue == LosacoWeb.Shared.Enumes.StatueResponse.Success)
{
<br />
<li><h4><b >Group:</b> @prodSrCls.GoodsGroupItem_Name</h4></li>
<br />
<li><h4><b >Model:</b> @prodSrCls.Goods_GoodsName </h4></li>
}
@if (prodSrCls.Responses.Statue == LosacoWeb.Shared.Enumes.StatueResponse.Failed)
{
<br />
<li>
<h3>
<span ></span><b >
Serial Is not Correct
</b>
</h3>
</li>
}
}
</ul>
</div>
</div>
</div>
</div>
<!-- end .col-md-6 -->
</div>
<!-- end .row -->
</div>
<!-- end .container -->
</section>
And C# Programming Code Part Is As Bellow:
public bool IsSaveLoading = false;
private string serial;
public String StrSerialNumber
{
get
{
return serial;
}
set
{
serial = value;
TextChangedEvetFotCleaning();
}
}
ProdSerialClasses prodSrCls
= new ProdSerialClasses();
[Parameter]
public EventCallback<ProdSerialClasses> OnFindSerial { get; set; }
protected override async Task OnInitializedAsync()
{
IsSaveLoading = false;
}
My answer is that how I can resolve my problem. I have to use this code in a online shop project. My other pages work fine. but this page become lock after run.
CodePudding user response:
Hi. Change second part to :
public bool IsSaveLoading = false;
public String StrSerialNumber = "0";
ProdSerialClasses prodSrCls = new ProdSerialClasses();
[Parameter]
public EventCallback<ProdSerialClasses> OnFindSerial { get; set; }
protected override async Task OnInitializedAsync()
{
IsSaveLoading = false;
}
you must add value to you variable StrSerialNumber = "0"
because in can cause of error with null value.
I hope your code problem is solved this way.
You should also check for prolapse before using prodSrCls
. If it is not null, you can use it. If you do not bet, you may still get the error.
@if(prodSrCls != null)
{
// your codes . . .
}
Please do not forget to confirm the answer.