This project is read-only.


Ability to add custom classes to HTML


I think this has been suggested before in discussions, but I couldn't find it.

The idea is that you might be able to write something like this.

[HtmlClass("RequiresConfirmation, bold")]
public void DoSomething() {}

and that "RequiresConfirmation" and "bold" will then be appended onto the class for that action when rendered in HTML. This could be picked up by CCC (e.g. the 'bold' bit) and/or by JavaScript (e.g. to force a local confirmation dialog).
Closed Mar 21, 2014 at 4:30 PM by RichardPawson


RichardPawson wrote Dec 11, 2013 at 12:19 PM

Probably better not to make it HTML specific. Think about 'RO' - we would want this same information included as custom extensions, probably. So, perhaps [UIHint] ?

RichardPawson wrote Dec 11, 2013 at 12:33 PM

Have just realised that [UIHint] is a System.ComponentModel.DataAnotation attribute, so we should use that if it fits our needs.

RichardPawson wrote Dec 11, 2013 at 5:55 PM

Turns out - yet again - that Microsoft has annoyingly restricted the use of the UIHint attribute to Properties. We want to be able to apply it to a Class, a Property, a Method (action) or a parameter. So we will need to do our own, but need to have a different name e.g. [RenderingHint].

Could also have a cleaner, simpler, syntax, so you just provide as many (string) hints as you want.

In Mvc these would be added as classes to the Html at the appropriate level.

In RO these would be added as (multiple) custom extensions i.e. x-ro-nof-renderinghint (is it Ok to have multiple custom extensions of the same type?)

RichardPawson wrote Jan 29, 2014 at 12:19 PM

Currently thinking: [PresentationHint]

scascarini wrote Jan 31, 2014 at 11:36 AM

Done for MVC added a ticket to support on RO