Create a name system to html Id attibute so they do not repeat <p>I'm not sure if I make sense, maybe there are easier ways.</p> <p>I am building a web app, which will be based in Bootstrap models, what I want is to display a model to make CRUD operations to my database. </p> <p>For example I will have a models like these:</p> <pre><code>public class Author { public int id { get; set; } public string Name { get; set; } } public class Book { public int id { get; set; } public string Name { get; set; } } </code></pre> <p>What I want is to make a partial view that will display a dialog (modal) to add a new author to my app, same with books, and my 'n' classes my app will have, I want to render these partials wherever I need them. So I can add an author from any view of my page.</p> <p>That part is ok, now I am having some 'troubles' because when I make an ajax post call to save my author in my data base I am facing that I already had a #Name field which was the one rendered for my books modal now when I call my field with jQuery, like this: <code>$('#Name').val()</code> it will grab the first #name.</p> <p>That is easy to solve I will make a #AuthorName and a #BookName.</p> <p>Now I am scared that my application will not be stable if my name system is not.</p> <p>So is there any way to make an name system?</p> <p>I am not sure how to do this but I would like to write my id's like this:</p> <pre><code> @Html.TextBoxFor(u =&gt; u.Id, new { @id = "@MyDialogs.Authors.Add.Name" }) </code></pre> <p>that will return something like this: <code>dialogs-authors-add-namefield</code></p> <p>Is this possible or I am being too lazy?</p>