This is a migrated thread and some comments may be shown as answers.

Links in grid cell

2 Answers 33 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Henrik
Top achievements
Rank 1
Henrik asked on 26 Oct 2018, 06:59 AM

Hi,

I have a grid where I want a link in some of the cells in one column. The logic for deciding the link is quite complex, so I wanted to have that logic in the read method for the grid in the controller. It was a bad idea for some reasons, but the strange thing is that the update and destroy methods of the grid stopped working. They were not called at all.

I fooled around a bit and found that if you have a property in the view model that is not even shown in the grid and you have a link in that property the update and destroy methods stop working - they are not called.

The project is quite large, so I have attached only the relevant code snippets. You should be able to test just by adding a string property in any view model and set the value to a link like it is done in the example.

My question is: Is this the desired behaviour of the grid or if I have stumbled on a bug.

Best regards,

Henrik

 

2 Answers, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 30 Oct 2018, 06:50 AM
Hello Henrik,

Thanks for the provided code.

The issue is caused since the model contains a field which value is an anchor tag. By default the MVC framework does not allow submitting html. To allow submitting HTML either use the AllowHtmlAttribute over the Extra proeprty.

e.g.

[AllowHtml]
public string Extra { get; set; }

Or disable the validation for the edit and update actions via the ValidateInputAttribute.

e.g.

[ValidateInput(false)]
public ActionResult Edit(ViewModel viewModel)


Regards,
Georgi
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Henrik
Top achievements
Rank 1
answered on 30 Oct 2018, 07:17 AM

Hi Georgi,

Many thanks for the reply. Now I know how to handle this case.

Best regards,

Henrik

Tags
Grid
Asked by
Henrik
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Henrik
Top achievements
Rank 1
Share this question
or