Currently, there's no way to control the id attribute for input. The protected InputId { get; private set; } property is set to a random (GUID-based) ID by the EnsureInputId() method, which is called only when the Label is rendered.
When there is no Label, no id is rendered. There is no way to set your own id, and the id from AdditionalAttributes is ignored (even if InputId is not set). Some derived components with complex structures (such as InputDate) have different logic for handling the id.
If it turns out that the id should be controllable, we should consolidate the related logic. (We should probably respect the id set from InputBase.AdditionalAttributes?)
Currently, there's no way to control the
id
attribute forinput
. Theprotected InputId { get; private set; }
property is set to a random (GUID-based) ID by theEnsureInputId()
method, which is called only when theLabel
is rendered.When there is no
Label
, noid
is rendered. There is no way to set your ownid
, and theid
fromAdditionalAttributes
is ignored (even ifInputId
is not set). Some derived components with complex structures (such asInputDate
) have different logic for handling theid
.If it turns out that the
id
should be controllable, we should consolidate the related logic. (We should probably respect theid
set fromInputBase.AdditionalAttributes
?)