I am having an issue with my checkboxes unchecking as soon as I check them.
Here is my model:
class
AppRegistration
{
public
DateTime DateCreated {
get
;
set
; }
public
List<RoleRequest> RolesRequested {
get
;
set
; }
public
string
Approver {
get
;
set
; }
public
string
Status {
get
;
set
; }
public
string
Description {
get
;
set
; }
public
int
Id {
get
;
set
; }
}
enum
Role
{
MFAAdmin,
ListServerAdmin,
SecretServerAdmin,
IdentityAdmin
}
class
RoleRequest
{
public
Role Role {
get
;
set
; }
public
bool
Requested {
get
;
set
; }
}
Here is my markup:
<div
class
=
"col"
>
@{
_newAppReg =
new
AppRegistration();
_newAppReg.RolesRequested =
new
List<RoleRequest>();
foreach
(var role
in
Enum.GetValues(
typeof
(Role)))
{
_newAppReg.RolesRequested.Add(
new
RoleRequest
{
Role = (Role)role
});
}
foreach
(var r
in
_newAppReg.RolesRequested)
{
<div
class
=
"mt-sm"
>
<TelerikCheckBox @bind-Value=
"@r.Requested"
Enabled=
"@true"
Id=
"@r.Role.ToString()"
>
</TelerikCheckBox>
<label
for
=
"@r.Role.ToString()"
>@r.Role.ToString()</label>
</div>
}
}
</div>