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

Combo box text issue

1 Answer 28 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Sridevi
Top achievements
Rank 1
Sridevi asked on 20 May 2013, 07:34 PM

 

 

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

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 21 May 2013, 07:19 AM
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.
Tags
ComboBox
Asked by
Sridevi
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or