I do not know what happened in this code
hamed farjad
40
Reputation points
this is a Blazor code that sends my friend to me and I do not know where I highlighted the code "x" what do , please explain me .
thank you .
@page "/"
<table>
<tr>
<td>کد ملی:</td>
<td colspan="3">
<input @bind-value="profile.NationalCode" style="width:100%"/>
</td>
</tr>
<tr>
<td>نام:</td>
<td><input @bind-value="profile.FirstName" /></td>
<td>نام خانوادگی:</td>
<td><input @bind-value="profile.LastName" /></td>
</tr>
<tr>
<td>نام پدر:</td>
<td><input @bind-value="profile.FatherName" /></td>
<td>تاریخ تولد:</td>
<td><input @bind-value="profile.BirthDate" /></td>
</tr>
<tr>
<td colspan="4">
<button class="btn btn-info" @onclick="CallNew">جدید</button>
<button class="btn btn-success" @onclick="CallSave">ذخیره</button>
<button class="btn btn-danger" @onclick="CallDelete">حذف</button>
</td>
</tr>
</table>
<hr />
<table style="width:100%">
<thead>
<tr>
<th></th>
<th>کد ملی</th>
<th>نام</th>
<th>نام خانوادگی</th>
<th>تاریخ تولد</th>
<th>نام پدر</th>
</tr>
</thead>
<tbody>
@foreach (var item in myList)
{
<tr>
<td><button class="btn btn-sm btn-primary" @onclick="(()=>Edit(item.NationalCode))">ویرایش</button></td>
<td>@item.NationalCode</td>
<td>@item.FirstName</td>
<td>@item.LastName</td>
<td>@item.BirthDate</td>
<td>@item.FatherName</td>
</tr>
}
</tbody>
</table>
@code{
class hamed
{
public string NationalCode { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string BirthDate { get; set; }
public string FatherName { get; set; }
}
List<hamed> myList = new List<hamed>();
hamed profile = new hamed();
void CallNew()
{
profile = new hamed();
}
void CallDelete()
{
myList.Remove(value);
CallNew();
}
void CallSave()
{
myList.Add(profile);
profile = new hamed();
}
void Edit(string nationalCode)
{
}
}
Sign in to answer