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

Javascript method Add Item

1 Answer 16 Views
RadioButtonList
This is a migrated thread and some comments may be shown as answers.
gonzalez
Top achievements
Rank 1
Veteran
gonzalez asked on 12 Apr 2021, 10:10 PM

there is a way to add an item by javascript, like this

radiobuttonlist.get_items().add( new Telerik.Web.UI.ButtonListItem())

 

1 Answer, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 15 Apr 2021, 02:05 PM

Hi gonzalez,

With the current implementation of RadRadioButtonlist each ButtonListItem has its already assigned (and rendered) HTML element, thus such item cannot be created dynamically via JavaScript.

If adding a custom button from the server is applicable tot he scenario you are after, you can achieve it like follows:

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ButtonListItem btn = new ButtonListItem("custom btn", "btn value");
            RadRadioButtonList1.Items.Add(btn);
        }
    }

Regards,
Vessy
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
RadioButtonList
Asked by
gonzalez
Top achievements
Rank 1
Veteran
Answers by
Vessy
Telerik team
Share this question
or