Is there a ready-made way to create unique "id" tags in ASP.NET MVC?
(Similar to the dangerous but sometimes useful ClientIDs in WebForms?)
This would be useful when viewing a partial view multiple times on a page.
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%-- Example Partial View --%>
<div id="<%=GenerateAUniqueIDHere()%>">
Content
</div>
<script type="text/javascript">
$("#<%=GenerateAUniqueIDHere%>").hide().fadein().css("font-size", "500%");
</script>
If not, itβs easy enough to collapse.
Thank you so much,
John
source
share