I have also found that I rarely need to insert a label via ERT.
When I need a label in the middle of some latex code, I
use two ERT boxes. The first contains latex code up to where
I need that label. Then I insert a normal LyX label immediately
after the ERT box. Finally, the last ERT box with the rest of the
latex code.
Splitting up the ERT like this lets me use a normal LyX label,
which will show up in the cross reference dialog as usual.
Helge Hafting
In may case it is not a normal label, but one used to refer to a line number in an algorithm. I need to use the command \lnl, so I
really need to use an ERT box.
Nicolás