RadComboBox hide items

2 posts, 0 answers
  1. Vitaly
    Vitaly  avatar
    86 posts
    Member since:
    Aug 2011

    Posted 08 Aug 2014 Link to this post

    Good Afternoon,
    in my html  I have a RadComboBox:

    <telerik:RadComboBox ID="ddlDurationofAssign" runat="server" Width="130px" Font-Size="Small" CssClass="txtinput1" AutoPostBack="true" TabIndex="5" OnSelectedIndexChanged="ddlDurationofAssign_SelectedIndexChanged" OnClientFocus="ClientFocus" OnClientBlur="ClientBlur" >
    <telerik:RadComboBoxItem Text="SELECT TERM" Value="E" Selected="true" />
    <telerik:RadComboBoxItem Text="Fall" Value="F" />
    <telerik:RadComboBoxItem Text="Spring" Value="S" />
    <telerik:RadComboBoxItem Text="Full Term" Value="W" />

    On Page Load I would like to  hide "Full Term" item based on certain criteria. How can I do that?

    Thanks so much for your help.
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 10 Aug 2014 in reply to Vitaly Link to this post

    Hi Vitaly,

    Please try the below C# code snippet to hide an item based on the condition.

    protected void Page_Load(object sender, EventArgs e)
        // your condition code
            RadComboBoxItem item = (RadComboBoxItem)ddlDurationofAssign.FindItemByText("Full Term");
            item.Visible = false;

Back to Top