I have a webform with a checkbox in it. I need to do two things differently based on an environment setting.
- Add a class
-
Add the Text attribute so a label gets created
<% if setting == true) { %> <asp:CheckBox ID="optionCheckbox" class="option-checkbox radio-checkbox" runat="server" Text="Label Text"/> <% } else { %> <asp:CheckBox ID="optionCheckbox" class="option-checkbox" runat="server"/> <% } %>
The problem with this is the page won't render because the ids are the same, even though only one could ever get rendered. There is a lot of other processing with javascript and such so I don't want different ids for each scenario.
Aucun commentaire:
Enregistrer un commentaire