Telerik Forums
UI for ASP.NET MVC Forum
1 answer
97 views

Hi,

 

I have a kendo grid, user wants to enter html data in one of the column.

user clicks edit button on the grid row then an edit form opens as popup. This edit form is a model.cshtml with all the fields of the model on it. This edit cshtml does not have any button on it. "Update" button is created on fly.

User enters html data (tags etc) and clicks Update button then it return 401 error. Which I think is because its taking the tags as an injection attack. If user enters normal text then it works fine.

what can do to make the edit form allow submit html tags data? can you please help me?

 

Thanks

CNS

Anton Mironov
Telerik team
 answered on 12 Jul 2023
1 answer
79 views

Hi, 

   I wonder if you could help. I have a Kendo UI grid that has 2 bool elements, this is a MVC core 3.1 project.  When I click on the Create or Update buttons on the Edit popup, nothing happens - no errors and the controller action is not being called. 

    I have code similar to the following code for the grid itself : 


@(Html.Kendo().Grid<MyObject>()
    .Name("MyGrid")
    .DataSource(dataSource => dataSource
        .Ajax()
        .Model(m => m.Id(e => e.Id))
        .PageSize(20)
        .Read(read => read.Action("Read", "ActionRead"))
        .Create(create => create.Action("Create", "ActionCreate"))
        .Update(update => update.Action("Update", "ActionUpdate"))
        .Events(events => events.Error("onError"))
    )
    .Columns(columns =>
    {
        columns.Bound(p => p.Name);
        columns.Bound(p => p.IsCompleteStatus).ClientTemplate("<input type='checkbox' #= IsCompleteStatus ? checked='checked' :'' # />"); 
        columns.Bound(p => p.IsPendingStatus);
columns.Command(command =>
        {
            command.Edit();
            command.Custom("Remove").Click("onRemove").Visible("isRemoveable").IconClass("k-icon k-i-delete k-icon-32");
            command.Custom("Restore").Click("onRestore").Visible("isRestorable").IconClass("k-icon k-i-reset k-icon-32");
        });
    })
    .ToolBar(toolbar => toolbar.Create().Text("Add Status"))
    .Editable(editable => editable.Mode(GridEditMode.PopUp))
    .GridDefaults()

And this is what I have in my view for the popup window: 

 


<form>
    <div asp-validation-summary="ModelOnly" class="text-danger"></div>
    <input asp-for="Id" type="hidden" />
    @Html.FormGroupFor(m => m.Name)
    @Html.EditorFor(m => m.IsCompleteStatus)  
  @Html.FormGroupFor(m => m.IsPendingStatus)
</form>

The popup displays fine. However clicking on the Create button (when I hit 'Add') or the Update button (when I click on 'Edit') does absolutely nothing, unless I actually check the checkbox. 

If it is a bool type, it also doesn't let me leave it empty, so it needs it checked all the time.

If it a bool? type, it doesn't let me interact with it at all - I cannot check the boxes, so no Create/Update either.    If I remove the checkboxes from the view, it displays and works fine.  Can you help please? Thank you 

Tsvetomir
Telerik team
 answered on 09 Dec 2021
0 answers
226 views

I have a login form that have a boolean item (Remember Me) which is a bool value, The form shows the field as Input (Text Field) .. This is the form :

 


@(Html.Kendo().Form<SchoolCore.Models.ViewModel.LoginViewModel>()
                                                .Name("LoginForm")
                                                .Validatable(v =>
                                                {
                                                    v.ValidateOnBlur(true);
                                                    v.ValidationSummary(vs => vs.Enable(false));
                                                })
                                                .HtmlAttributes(new { action = "Login", method = "POST" })
                                                .Items(items =>
                                                {
                                                    items.Add()

                                                        .Field(f => f.Email)
                                                        .Label(l => l.Text("Email :"));

                                                    items.Add()
                                                        .Field(f => f.Password)
                                                        .Label(l => l.Text("Password :"));

                                                    items.Add()
                                                        .Field(f => f.RememberMe))
                                                        .Label(l => l.Text("Remember Me"));
                                                })
                                            )

What I miss?

Thanks in advanced

Abdulsalam Elsharif
Top achievements
Rank 2
Iron
Iron
 asked on 16 Sep 2021
Narrow your results
Selected tags
Tags
+? more
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?