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

Showing PartialViews with same controls multiple times

1 Answer 534 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Thomas
Top achievements
Rank 1
Thomas asked on 21 Nov 2016, 10:28 AM

Hi,

I have a partial view that is referring to a model. I can open multiple models at the same time, which reflects in having that particular partial view shown multiple times.

The problem now is that every controlinside of it has an id (grids, multiselects ...), and by showing it multiple times I get into the situation that I have multiple controls with a same id.

Actually I can open it just 2 times, bcz then the controls get "broken" and dont load properly anymore (I need to refresh the page to get it working again).

 

Is there a way around that, best practice or smt ?

Regards

 

 

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 23 Nov 2016, 08:01 AM
Hello Thomas,

You could use an unique value from the model to make the Name of the helpers unique as well. The same principal is used for example in the following demo, where the nested grid Name is using an unique value from the parent row:
Hope this helps.


Regards,
Konstantin Dikov
Telerik by Progress
Telerik UI for ASP.NET MVC is ready for Visual Studio 2017 RC! Learn more.
Tags
General Discussions
Asked by
Thomas
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or