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

[Solved] Getting a ComboBox reloaded

1 Answer 142 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Brad
Top achievements
Rank 2
Brad asked on 06 Jan 2010, 10:25 PM
2 ComboBoxes in a Form:

                        <telerik:RadComboBox ID="ClientCB" DataSourceID="ClientList" DataTextField="Client"

                            DataValueField="ClientKey" AppendDataBoundItems="true" runat="server" Skin="Outlook"

                            Width="250px" AutoPostBack="true"

                            onselectedindexchanged="ClientCB_SelectedIndexChanged">

                        </telerik:RadComboBox>


                        <telerik:RadComboBox ID="UsrCB" DataSourceID="TrainUserList" DataTextField="FullName"

                            DataValueField="ID" AppendDataBoundItems="true" runat="server" Skin="Outlook"

                            Width="250px" AutoPostBack="true" onselectedindexchanged="UsrCB_SelectedIndexChanged">

                        </telerik:RadComboBox>


I want a selection in the ClientCB to force the UsrCB to reload with new data. Here are the DataSources:

    <asp:SqlDataSource ID="ClientList" runat="server" ConnectionString=""

        SelectCommand="Generic_ClientList" SelectCommandType="StoredProcedure">

    </asp:SqlDataSource>

    <asp:SqlDataSource ID="TrainUserList" runat="server" ConnectionString=""

        SelectCommand="Train_TrainUserList" SelectCommandType="StoredProcedure">

        <SelectParameters>

            <asp:Parameter DefaultValue="0" Name="ClientKey" Type="Int32" />

        </SelectParameters>

    </asp:SqlDataSource>


This is my server side code:

    protected void ClientCB_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)

    {

        TrainUserList.SelectParameters["ClientKey"].DefaultValue = e.Value;

        

        RadComboBox ThisCB = o as RadComboBox;

        RadComboBox TUsrCB = ThisCB.Parent.FindControl("UsrCB") as RadComboBox;

        TUsrCB.DataBind();

    }


Everything looks to be right but the data in the UsrCB never changes. I KNOW the proc works because I have an initial set of data in it. But it never changes.

?????????

Joe B





1 Answer, 1 is accepted

Sort by
0
Genady Sergeev
Telerik team
answered on 08 Jan 2010, 03:24 PM
Hi Joe,

There is no need to use any code behind at all. I have prepared sample project demonstrating how to implement related ComboBoxes using SqlDataSource only. You can find it as an attachment.

Greetings,
Genady Sergeev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
ComboBox
Asked by
Brad
Top achievements
Rank 2
Answers by
Genady Sergeev
Telerik team
Share this question
or