Reputation: 3134
The new .NET v4 offers some great ways to customise output of control IDs, so they're clean and easier to use with JavaScript.
However, I'd sometimes like to completely suppress the output of a control's ID in the HTML. Is that possible, on a per-control basis?
eg:
<div class="myclass" id="mycontrol" runat="server">
... some HTML
</div>
I want to conditionally control output (visibility) of "mycontrol" in the codebehind. But, when it is visible, I want the HTML output to be simply:
<div class="myclass">
... some HTML
</div>
Do we have that level of control in .NET 4? I mean directly and easily, ie. without wrapping it in a Placeholder or doing custom rendering.
Upvotes: 0
Views: 116
Reputation: 13579
you can use combination of asp. net and jquery for your top part you can do this if you are using .net 4.0
<div class="myclass" ClientIDMode="Static" id="mycontrol" runat="server">
... some HTML
</div>
and with jquery you can
$(".myclass").removeAttr("id")
and remove more unnecessary attributes
<div class="myclass">
... some HTML
</div>
Upvotes: 1