I'm trying to create a form with text boxes and combo boxes, that have a set width and right aligned labels.
Using the label attribute of the of the controls, the final rendered output between the two are not consistent. The text box puts the <label> and the <input type=text> in two different table cells. While the combobox renders with in a single cell. So using CSS on the LabelCssClass doesn't get the same results.
I've seen examples on your site of right aligned text on the combo box (http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/expandanimation/defaultcs.aspx) but it is using standard text instead of the <label for="">. I need it to use the label tag for 508 compliance.
Can you point me to another example of how this is done?
Using the label attribute of the of the controls, the final rendered output between the two are not consistent. The text box puts the <label> and the <input type=text> in two different table cells. While the combobox renders with in a single cell. So using CSS on the LabelCssClass doesn't get the same results.
I've seen examples on your site of right aligned text on the combo box (http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/expandanimation/defaultcs.aspx) but it is using standard text instead of the <label for="">. I need it to use the label tag for 508 compliance.
Can you point me to another example of how this is done?
8 Answers, 1 is accepted
0

Kevin
Top achievements
Rank 2
answered on 05 Oct 2011, 01:42 PM
Hello Marc,
You can use the Label control and set the AssociatedControlID to the control it's related to and it will render itself as a label tag.
I hope that helps.
You can use the Label control and set the AssociatedControlID to the control it's related to and it will render itself as a label tag.
I hope that helps.
0

Marc
Top achievements
Rank 1
answered on 05 Oct 2011, 02:21 PM
I tried that first. It would be the easy way to do it.
But it doesn't work. Yes you can associate it with the ID of the combo box. But on final render, the ID of the combo box changes. So this method doesn't get my desired effect.
But it doesn't work. Yes you can associate it with the ID of the combo box. But on final render, the ID of the combo box changes. So this method doesn't get my desired effect.
0
Accepted

Kevin
Top achievements
Rank 2
answered on 05 Oct 2011, 07:05 PM
Hello Marc,
After looking at the label generated by the RadComboBox, the control it sets focus to is the input control of the RadComboBox. So you create your labels like so:
I hope that helps.
After looking at the label generated by the RadComboBox, the control it sets focus to is the input control of the RadComboBox. So you create your labels like so:
<
label
for='<%=RadComboBox1.ClientID %>_Input'>Some label:</
label
>
I hope that helps.
0

Marc
Top achievements
Rank 1
answered on 06 Oct 2011, 06:41 PM
Thank you. This works great.
0

Marc
Top achievements
Rank 1
answered on 06 Oct 2011, 06:56 PM
I know this is a different control... but since you know the history, can you help me with the calendar control too?
0

Kevin
Top achievements
Rank 2
answered on 07 Oct 2011, 01:27 PM
Hello Marc,
I'm assuming the calendar you're talking about is the RadDatePicker. If so, this is how you would create a label that would set focus to the coontrol:
Also, if you set ShowPopupOnFocus="true" on the RadDatePicker, the calendar popup will automatically show when you click on the label.
I hope that helps.
I'm assuming the calendar you're talking about is the RadDatePicker. If so, this is how you would create a label that would set focus to the coontrol:
<
label
for='<%=RadDatePicker1.ClientID %>_dateInput_text'>
Some label:</
label
>
Also, if you set ShowPopupOnFocus="true" on the RadDatePicker, the calendar popup will automatically show when you click on the label.
I hope that helps.
0

Marc
Top achievements
Rank 1
answered on 14 Oct 2011, 02:29 PM
Thank you the DatePicker worked great too.
Next problem.... How do I make these work inside a RadGrid Formtemplate? It gives an error that it doesn't recognize the ID of the combobox/datepicker.
example: <label for='<%=cmb_state.ClientID%>_Input'>State:</label>
error CS0103: The name 'cmb_state' does not exist in the current context
Next problem.... How do I make these work inside a RadGrid Formtemplate? It gives an error that it doesn't recognize the ID of the combobox/datepicker.
example: <label for='<%=cmb_state.ClientID%>_Input'>State:</label>
error CS0103: The name 'cmb_state' does not exist in the current context
0

Princy
Top achievements
Rank 2
answered on 14 Oct 2011, 02:44 PM
Hello Marc,
This error comes because the control is not available directly on the page. Its is residing inside one control. You need to use the findControl method to access the control if it is inside ItemTemplate.
Thanks,
Princy.
This error comes because the control is not available directly on the page. Its is residing inside one control. You need to use the findControl method to access the control if it is inside ItemTemplate.
Thanks,
Princy.