Novkovski Stevo Bato
Novkovski Stevo Bato

Reputation: 1043

Is there anyway to apply telerik combo on dynamic created select-box via JavaScript?

I have java script which create select box depend of ajax result.

For example, if result = 2x combo, i create 2x select box via javascript.

if (this.Type == "combo") {
                var result = "<label>" + this.Name + "</label><select onChange='ProChange(this)' name='" + this.ID + "'>";

                result += "<option value='0'>Please select</option>";
                for (var i = 0; i < this.Values.length; i++) {
                    var resultId = this.Values[i].ID;
                    var resultName = this.Values[i].Name;

                    result += "<option value= " + resultId + ">" + resultName + "</option>";
                }
                result += "<option value='-1'>Other</option>";
                result += "<input type='text' name='"+this.ID+"other' style='display:none;' id='"+this.ID+"' />";
                result += "</select>";

So my main question is, can i apply telerik style on dynamic created select box?

Upvotes: 0

Views: 216

Answers (1)

bodee
bodee

Reputation: 2674

You can use the Telerik RadFormDecorator

<telerik:RadFormDecorator ID="rfd_combo" runat="server" DecoratedControls="Select" />

and after creating your controls by javascript:

$find("<%= rfd_combo.ClientID %>").decorate();

More details: http://www.telerik.com/support/kb/aspnet-ajax/formdecorator/decorate-dynamically-added-controls-by-using-radformdecorator.aspx

Upvotes: 1

Related Questions