views:

13

answers:

1

I am using RadListBox and RadDateTimePicker in a traditional C# ASP.Net 3.5 web application, and I have labels like this:

<asp:Label ID="lblStartDate" runat="server" Text="Start Date" AssociatedControlID="dtpStartDate" />
<telerik:RadDateTimePicker ID="dtpStartDate" runat="server">
</telerik:RadDateTimePicker>

The label doesn't connect to the date picker with a for attribute because the picker is a complex control and it can't work out which element to target. Telerik propose a JavaScript solution to this, but that seems unwieldy to me and also depends on client side scripting.

Is there a better way which will provide a reasonable level of accessibility? Either wrapping the Telerik solution somehow or an altogether alternative approach?

A: 

Yep, the Telerik picker is a composite control as well and similar javascript to attach the label to the date input should do the trick. To reference the input field, use the get_dateInput() property from the client API of the picker.

Dick Lampard
But I still have to repeat that JavaScript snippet on a per control basis?
robertc
Suppose so, yes. You can, however, wrap it in a user control or a composite control to be reused on different places in your app.
Dick Lampard