appendto / juiceui

Juice UI is an open-source collection of WebForms components that brings jQuery UI Widgets to your project with ease. Start leveraging the power of the world's most popular JavaScript UI library while working with familiar code in your ASP.NET projects.
http://juiceui.com
GNU General Public License v2.0
125 stars 58 forks source link

Radio and Check Box Extenders #1

Closed shellscape closed 12 years ago

shellscape commented 12 years ago

asp:RadioButton and asp:CheckBox.

The server control is assigning the widget name to an attribute of the web server control:

targetControl.Attributes["data-ui-widget"] = Widget.WidgetName;

On the client the widget name is taken from the rendered element:

var element = $('#' + id), widgetName = element.attr('data-ui-widget');

This works in most cases except for the RadioButton and CheckBox server controls. The <asp:RadioButton> and <asp:CheckBox> will be rendered as <input id="xx" type="xx">xxx</input><label for="xxx" />. If you assign an attribute to these server controls it renders:

<span> <input id="xx" type="xx">xxx</input><label for="xxx" /></span>.

Herein lies the problem, the <span> is the guy getting the attribute and the client code assumes the attribute is on the <input> element.

john-ayers commented 12 years ago

If we take CheckBox as an example, setting any of the following properties:

Will cause the CheckBox to render a span.

Would it be a big change to serialize the widget name to json, that would work for any conceivable scenario. Otherwise you'd have to handle both cases (data-ui-widget on the span or on the input element).

shellscape commented 12 years ago

Original reporter confirms fixed with changes for 0.9.1.