Hi,
I keep getting the error show below:
EditForm requires either a Model parameter, or an EditContext parameter, please provide one of these.
It happen when I click on a NON-root item to edit.
Any ideas?
<
TelerikWindow
Visible
=
"@ShowComments"
Modal
=
"true"
Width
=
"55vw"
Height
=
"60vh"
>
<
WindowTitle
>
@CommentDlgTitle
</
WindowTitle
>
<
WindowActions
>
<
WindowAction
Name
=
"Close"
OnClick
=
"@OnCloseFindComments"
></
WindowAction
>
</
WindowActions
>
<
WindowContent
>
<
div
class
=
"form-row justify-content-end ml-2"
>
<
div
class
=
"col overflow-y:auto"
>
<
br
/>
<
TelerikTreeList
Data
=
"@CommentsData"
ItemsField
=
"@(nameof(CommentItem.Children))"
@
ref
=
"CommenterTL"
Pageable
=
"true"
Sortable
=
"true"
FilterMode
=
"@TreeListFilterMode.FilterMenu"
SelectionMode
=
"@TreeListSelectionMode.Single"
Resizable
=
"true"
Reorderable
=
"true"
EditMode
=
"@TreeListEditMode.Popup"
OnEdit
=
"@EditComment"
OnCreate
=
"@CreateComment"
OnUpdate
=
"@UpdateComment"
OnDelete
=
"@DeleteComment"
>
@*OnUpdate="@UpdateItem"*@
<
TreeListToolBar
>
<
TreeListCommandButton
Command
=
"Add"
Icon
=
"add"
>Add</
TreeListCommandButton
>
</
TreeListToolBar
>
<
TreeListColumns
>
<
TreeListColumn
Title
=
"Subject"
Width
=
"250px"
Field
=
"FindComment.Subject"
Editable
=
"true"
Expandable
=
"true"
>
<
EditorTemplate
Context
=
"ctx"
>
@{
var item = (ctx as CommentItem);
//Enabled = "@(item.FindComment.ParentCommentId == null)"
if (item.FindComment == null)
{
item.FindComment = new FindComment();
}
item.FindComment.Subject = SelectedComment.FindComment.Subject;
//SelectedComment = item;
<
TelerikTextBox
@
bind-Value
=
"@SelectedComment.FindComment.Subject"
>
</
TelerikTextBox
>
}
</
EditorTemplate
>
</
TreeListColumn
>
<
TreeListColumn
Title
=
"Comment"
Resizable
=
"false"
Editable
=
"true"
Field
=
"FindComment.Comment"
Width
=
"350px"
>
<
EditorTemplate
Context
=
"ctx1"
>
@{
var item = (ctx1 as CommentItem);
if (item.FindComment == null)
item.FindComment = new FindComment();
SelectedComment = item;
//var c = (ctx1 as CommentItem);
//if (c.FindComment == null)
// c.FindComment = new FindComment();
<
TelerikTextArea
Width
=
"260px"
Class
=
"TelerikTextAreaWidth"
@
bind-Value
=
"@SelectedComment.FindComment.Comment"
>
</
TelerikTextArea
>
}
</
EditorTemplate
>
</
TreeListColumn
>
<
TreeListColumn
Title
=
"Name"
Width
=
"100px"
Field
=
"CommenterName"
Context
=
"ctx2"
Editable
=
"false"
>
</
TreeListColumn
>
<
TreeListCommandColumn
Width
=
"150px"
>
@{
if (SelectedComment != null && SelectedComment.FindComment.Id == appData.AppUser.Id || appData.AppUser.RoleId == (int)ROLE_ENUM.SysAdmin)
{
<
TreeListCommandButton
Command
=
"Add"
OnClick
=
"@OnAddCommentClick"
Icon
=
"add"
></
TreeListCommandButton
>
<
TreeListCommandButton
Command
=
"Edit"
OnClick
=
"@OnEditCommentClick"
Icon
=
"edit"
></
TreeListCommandButton
>
<
TreeListCommandButton
Command
=
"Delete"
Icon
=
"delete"
></
TreeListCommandButton
>
<
TreeListCommandButton
Command
=
"Save"
Icon
=
"save"
ShowInEdit
=
"true"
></
TreeListCommandButton
>
<
TreeListCommandButton
Command
=
"Cancel"
Icon
=
"cancel"
ShowInEdit
=
"true"
></
TreeListCommandButton
>
}
else
{
<
TreeListCommandButton
Command
=
"Add"
Icon
=
"add"
></
TreeListCommandButton
>
<
TreeListCommandButton
Command
=
"Save"
Icon
=
"save"
ShowInEdit
=
"true"
></
TreeListCommandButton
>
<
TreeListCommandButton
Command
=
"Cancel"
Icon
=
"cancel"
ShowInEdit
=
"true"
></
TreeListCommandButton
>
}
}
</
TreeListCommandColumn
>
</
TreeListColumns
>
</
TelerikTreeList
>
</
div
>
</
div
>
<
div
class
=
"form-row justify-content-end "
>
<
br
/>
<
TelerikButton
Class
=
"mt-2"
Icon
=
"cancel"
OnClick
=
"@OnCloseFindComments"
ButtonType
=
"@Telerik.Blazor.ButtonType.Button"
>Close</
TelerikButton
>
</
div
>
<
ConfirmWindow
ConfirmTitle
=
"Delete comment?"
ConfirmText=@("Are you sure you want to delete this comment? All sub comments will also be deleted.")
ButtonText
=
"Confirm"
OnCancelConfirm
=
"@OnCancelDeleteComment"
OnConfirm
=
"@OnConfirmDeleteComment"
Icon
=
"warning"
Visible
=
"@ShowConfirmDeleteComment"
>
</
ConfirmWindow
>
</
WindowContent
>
</
TelerikWindow
>