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

Binding radiobuttonlist when editing details record

2 Answers 79 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Dan asked on 22 Aug 2010, 01:53 AM

Hi,

I have a radgrid with a MasterTableView that has a GridTemplateColumn. Insidt the GridTemplateColumn is an asp.net radiobuttonlist. How can I initialize the selected index from the database before the details page displays? The radiobuttonlist selectedIndex cannot be bound declaratively on the aspx page

Thanks
Dan

2 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 25 Aug 2010, 11:13 AM
Hi Dan,

Actually, although not visible in the intellisense, you can you RadioButtonList's SelectedValue or SelectedIndex properties to declaratively set the selected value. For example:

<EditItemTemplate>
    <asp:RadioButtonList runat="server" SelectedIndex="<%# Eval("SomeProperty")%>">
        <asp:ListItem Text="text1" />
        <asp:ListItem Text="text2" />
    </asp:RadioButtonList>
</EditItemTemplate>

All the best,
Rosen
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
Dan
Top achievements
Rank 1
answered on 25 Aug 2010, 02:56 PM
Hi Rosen,

Thanks for the info. I tried your suggestion and although there is no error reported when setting the selectedIndex property of a radiobuttonlist in the aspx page, it doesn't seem to do anything. I even tried hardcoding the value as opposed to binding to a database field. I will just try to bind it in the code behind

Thanks
Dan
Tags
Grid
Asked by
Dan
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Dan
Top achievements
Rank 1
Share this question
or