Combo box text issue

2 posts, 0 answers
  1. Sridevi
    Sridevi avatar
    1 posts
    Member since:
    May 2013

    Posted 20 May 2013 Link to this post

     

     

    I have a combo box like this

    <
    telerik:RadComboBox ID="rcbAssets" runat="server" TabIndex="5" OnClientDropDownOpening="LoadAssets" OnItemsRequested="rcbAssets_ItemsRequested" OnClientDropDownClosed="showAssets"

     

     

     

    AutoPostBack="false" Width="250px" >

     

     

     

    <ItemTemplate>

     

     

     

    <div>

     

     

     

    <asp:CheckBox runat="server" ID="chk1" />

     

     

     

    <asp:Label runat="server" ID="Label1" AssociatedControlID="chk1">

     

    <%

     

    # Eval("AssetNumber")%>

     

     

     

    </asp:Label>

     

     

     

    </div>

     

     

     

    </ItemTemplate>

     

     

     

    </telerik:RadComboBox>

    In code behind, I tried to check some check boxes and set the text of the radcombobox...

     

     

     

     

     

    rcbSimilarParts.Text = "12354,12347";


    This text is not displaying

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 21 May 2013 Link to this post

    Hi Sridevi,

    Please have a look at the sample code I tried which works fine at my end.

    ASPX:
    <telerik:RadComboBox runat="server" ID="RadComboBox1" DataSourceID="SqlDataSource2"
        DataTextField="ShipCity" EmptyMessage="All Types" HighlightTemplatedItems="true"
        AllowCustomText="true" Width="300" Label="Type :" Skin="Office2010Silver">
        <ItemTemplate>
            <asp:CheckBox ID="CheckBox1" runat="server" />
            <asp:Label ID="Label1" runat="server" Text='<%# Eval("ShipCity") %>'></asp:Label>
            <telerik:RadTextBox ID="RadTextBox1" runat="server" Text="New Text">
            </telerik:RadTextBox>
        </ItemTemplate>
    </telerik:RadComboBox>
    <telerik:RadButton ID="RadButton1" runat="server" Text="Select" OnClick="RadButton1_OnClick" />
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
        SelectCommand="select top 20 * from [Orders]"></asp:SqlDataSource>

    C#:
    protected void RadButton1_OnClick(Object o, EventArgs e)
    {
     
        foreach (RadComboBoxItem item in RadComboBox1.Items)
        {
            if (item.Text == "London")
            {
                CheckBox chk = (CheckBox)item.FindControl("CheckBox1");
                chk.Checked = true;
                RadComboBox1.Text = "asdasd";
            }
        }
    }

    Thanks,
    Shinu.
Back to Top