This is a migrated thread and some comments may be shown as answers.

[Solved] Telerik Controls and Attributes with Dashes

2 Answers 214 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Danan
Top achievements
Rank 1
Danan asked on 11 Feb 2011, 04:10 PM
Im trying to add an Html Attribute to a Telerik DatePicker.  The Html Attribute name is "data-bind".  Since the Telerik API for adding attributes only accepts an object (not a dictionary like mvc html helpers) there is no valid way for me to have the Telerik control render this attribute.  The attribute is needed for KnockoutJS a client side databinding javascript library.  Can we get some support for dictionaries Telerik?

Example)
@Html.Telerik().DatePickerFor(m => m).HtmlAttributes(new {data-bind = "enable:isActive"})

This does not work. :(

2 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 14 Feb 2011, 01:06 PM
Hello Danan,

Our plans are to provide overload for HtmlAttributes method which takes IDictionary for the next official release of Telerik Components for ASP.NET MVC. 

Currently you can overcome this limitation with wiring onLoad client event of the component ( or document ready ) and modify its HTML

Best regards,
Georgi Krustev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Jonathan
Top achievements
Rank 1
answered on 06 Apr 2011, 07:12 PM
Standard MVC3 helpers convert underscores to dashes. Example: @Html.TextBoxFor(x => x.Foo, new { data_something_something = "value" }) renders as: <input type="text" id="foo" data-something-something="value"/>

Does Telerik have any plans do do the same?

Cheers,
Joanthan
Tags
General Discussions
Asked by
Danan
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Jonathan
Top achievements
Rank 1
Share this question
or