Dropdown or combobox inputs values to control parameter

2 posts, 0 answers
  1. Brian Palmer
    Brian Palmer avatar
    2 posts
    Member since:
    Sep 2009

    Posted 13 Nov 2009 Link to this post


    I have a radtoolbar with aa combo-box (RadComboBox1) inside a template.  I want to input the value selected the combo-box to a datasource control parameter.  I'm not sure how to do it.  The combo-box control ID is not listed when I modify the datasource.

    Thanks in advance for the help. 

    Here's the code for the toolbar:


    <telerik:RadToolBar ID="RadToolBar1" runat="server" Width="100%" 


    BorderStyle="None" Skin="Sitefinity">







    <telerik:RadToolBarButton runat="server" Text="New">






    <telerik:RadToolBarButton runat="server" Text="Filter">








    <telerik:RadComboBox ID="RadComboBox1" AutoPostBack="True" Runat="server">








    <telerik:RadComboBoxItem runat="server" Selected="True" Text="All" Value="0" />




    <telerik:RadComboBoxItem runat="server" Text="All Open Requests" Value="1" />




    <telerik:RadComboBoxItem runat="server" Text="My Open Requests" Value="2" />




    <telerik:RadComboBoxItem runat="server" Text="My Closed Requests" Value="3" />









    <telerik:RadToolBarButton runat="server" Text="Edit">








    <telerik:RadToolBarButton runat="server" Text="Print">








    <telerik:RadToolBarButton runat="server" Text="Search">








    <telerik:RadToolBarButton runat="server" Text="Refresh">



















    Here's the code for the datasource:



    asp:SqlDataSource ID="sqldsRequestsFiltered" runat="server"








    SelectCommand="csp_ith_ssl_requests_filtered" SelectCommandType="StoredProcedure">








    <asp:ControlParameter ControlID="RadComboBox1" Name="selection"




    PropertyName="SelectedValue" Type="Int32" />




    <asp:ControlParameter ControlID="lblUserName" Name="userid" PropertyName="Text"




    Type="String" />














  2. Peter
    Peter avatar
    6637 posts

    Posted 18 Nov 2009 Link to this post

    Hello Brian,

    One workaround is to handle the Selecting event of your SqlDataSource similar to this demo and find the RadComboBox in code behind:
    * * *
                <asp:Parameter Name="selection" Type="String" DefaultValue="0" />
    * * *

    protected void sqldsRequestsFiltered_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
            RadComboBox selectionComboBox = RadToolBar1.FindItemByText("Filter").FindControl("RadComboBox1") as RadComboBox;
            e.Command.Parameters["@selection"].Value = selectionComboBox.SelectedValue;

    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.
Back to Top