Showing PartialViews with same controls multiple times

2 posts, 0 answers
  1. Thomas
    Thomas avatar
    30 posts
    Member since:
    Jul 2016

    Posted 21 Nov 2016 Link to this post


    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 ?




  2. Konstantin Dikov
    Konstantin Dikov avatar
    2466 posts

    Posted 23 Nov 2016 Link to this post

    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.

    Konstantin Dikov
    Telerik by Progress
    Telerik UI for ASP.NET MVC is ready for Visual Studio 2017 RC! Learn more.
Back to Top