This is a migrated thread and some comments may be shown as answers.
set combobox datasource on radiobutton checkchanged
1 Answer 11 Views
This is a migrated thread and some comments may be shown as answers.
Christian
Top achievements
Rank 1
Christian asked on 07 Apr 2018, 09:01 AM

I have a situation where i have a listview with a itemtemplate, the template contains a set of radiobuttons and a combobox. Based on the checked value of the radiobutton i need to set the datasource on the combobox but not sure how to accomplish this in the best manner.

My listview,

<telerik:RadListView runat="server" ID="lvTimers" OnNeedDataSource="lvTimers_NeedDataSource">
                                <ItemTemplate>
                                    <div class="timer col-xs-12" data-timerid="">
                                        <div class="row">
                                            <div class="col-xs-3 col-md-2 col-lg-2 center-xs">
                                                <span class="hours">1</span>:
                                                <span class="minutes">21</span>:
                                                <span class="seconds">31</span><br />
                                                <asp:ImageButton runat="server" ID="btnStart" Visible='<%# Eval("StartTime") == null   %>' ImageUrl="~/images/web/icons/play.png" CommandArgument='<%# Eval("TimerId") %>' />
                                                <asp:ImageButton runat="server" ID="btnPause" Visible='<%# Eval("StartTime") != null   %>' ImageUrl="~/images/web/icons/pause.png" CommandArgument='<%# Eval("TimerId") %>' />
                                            </div>
                                            <div class="col-xs-8 col-md-9 col-lg-9">
                                                <asp:RadioButtonList runat="server" ID="rbType" RepeatDirection="Horizontal">
                                                    <asp:ListItem Value="1" Text="Frånvaro"></asp:ListItem>
                                                    <asp:ListItem Value="2" Text="Intern"></asp:ListItem>
                                                    <asp:ListItem Value="3" Text="Extern"></asp:ListItem>
                                                    <asp:ListItem Value="4" Text="Övrigt"></asp:ListItem>
                                                </asp:RadioButtonList>
                                                <telerik:RadComboBox runat="server" ID="cmbCustomers"></telerik:RadComboBox>
                                                <telerik:RadComboBox runat="server" ID="cmbProjects"></telerik:RadComboBox>
                                                <%# Eval("TimerId") %>
                                            </div>
                                            <div class="col-xs-1">
                                                <asp:ImageButton runat="server" ID="btnDelete" ImageUrl="~/images/web/icons/delete.png" CommandArgument='<%# Eval("TimerId") %>' />
                                                <asp:ImageButton runat="server" ID="btnUpdate" ImageUrl="~/images/web/icons/update.png" CommandArgument='<%# Eval("TimerId") %>' />
                                                <asp:ImageButton runat="server" ID="btnSave" ImageUrl="~/images/web/icons/save.png" CommandArgument='<%# Eval("TimerId") %>' />
                                            </div>
                                        </div>
                                    </div>
                                </ItemTemplate>
                            </telerik:RadListView>

 

Any helpful soul with any idea how to go about this?

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 11 Apr 2018, 10:06 AM
Hello Christian,

You can achieve this requirement using the following approach:
<asp:RadioButtonList ... AutoPostBack="true" OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged">
C#:
protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
    RadioButtonList list = sender as RadioButtonList;
    RadListViewDataItem item = list.NamingContainer as RadListViewDataItem;
    RadComboBox combo = item.FindControl("cmbCustomers") as RadComboBox;
    // execute custom binding logic to refresh the combo options
}

I hope this will prove helpful.

Regards,
Eyup
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.
Asked by
Christian
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or