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

How to bind SelectedValue

1 Answer 526 Views
RadioButtonList
This is a migrated thread and some comments may be shown as answers.
Greg
Top achievements
Rank 1
Greg asked on 22 Jan 2018, 08:01 PM

With a standard ASP .Net RadioButtonList it's simple to bind the SelectedValue:

<asp:RadioButtonList runat="server" ID="rbl_eit_Executed" SelectedValue='<%# Bind("Executed") %>'   
     RepeatDirection="Horizontal"  RepeatLayout="Table" TextAlign="Right">
          <asp:ListItem Value="False" Text="No"  />
         <asp:ListItem Value="True" Text="Yes"  />
</asp:RadioButtonList>

Attempting the same thing with RadRadioButtonList:

<telerik:RadRadioButtonList runat="server" Orientation="Horizontal"  
           SelectedValue="<%# Bind("Executed") %>"
           ID="rbl_eit_Executed" Direction="Horizontal"
            AutoPostBack="False">
        <Items>
               <telerik:ButtonListItem Text="Yes" Value="True" />
                <telerik:ButtonListItem Text="No" Value="False" />
         </Items>
</telerik:RadRadioButtonList>

Results in the error:

"A call to Bind must be assigned to a property of a control inside a template."

The ASP .Net control works inside an Edit Item Template - the Telerik control does not. How to databind SelectedValue (I do NOT care about binding the list of items, those are declarative as shown above).

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 24 Jan 2018, 12:05 PM

Hello Greg,

I have just answered your support ticket on this question and I am pasting the information here as well for anyone else with a similar issue.

When the data from the parent data-bound row matches exactly the declarative items this would work. I am attaching a small example that illustrates this, together with a short video as a reference.

There is an issue when the items in the radio button list are data bound as well - they do not get pre-selected (even though binding works) and I am logging this for fixing: https://feedback.telerik.com/Project/108/Feedback/Details/240926. A workaround for that would be using the asp:RadioButtonList and a telerik:RadFormDecorator. I have updated your Telerik points for bringing this to our attention.

If you have further questions, let's discuss them in the ticket to ensure faster resolution and privacy of any data.

 

 

Regards,

 

Marin Bratanov
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
RadioButtonList
Asked by
Greg
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or