Combox Empty Message

6 posts, 0 answers
  1. Shrirang
    Shrirang avatar
    10 posts
    Member since:
    May 2009

    Posted 06 May 2010 Link to this post

    Hi, 
    Wants to set Combox empty message at runtime


     

     

     

    <telerik:RadComboBox ID="ddlAction1"

     

     

    Width="110px" runat="server" EmptyMessage="Select Action" AllowCustomText="true"  Height="55px" OnClientLoad="OnClientLoad"  >

     

     

     

     

     

     

    <Items>

     

     

     

     

     

     

    <telerik:RadComboBoxItem Text="Copy" Value="2" />

     

     

     

     

     

     

    <telerik:RadComboBoxItem Text="Delete" Value="1" />

     

     

     

     

     

     

    </Items>

     

     

     

     

     

     

    </telerik:RadComboBox>

     

    After selecting any action copy or delete it performs repective code at cs side
    I used both methods at cs end

     

     

     

    ddlAction1.ClearSelection() method
    even set ddlAction1.EmptyMessage = "Select Action"

    i want to set empty message after every action
    please let me know
    Thanks

     

  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 06 May 2010 Link to this post

    Hello,

    I guess you want to show the EmptyMessage each time when page loads. If so, you can attach OnClientLoad event and clear the text in the handler as shown below.

    JavaScript:
     
    <script type="text/javascript"
        function OnClientLoad(sender, args) { 
            sender.clearSelection(); 
        } 
    </script> 

    Regards,
    Princy.
  3. Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 06 May 2010 Link to this post

    Hi Shrirang,

    As I understand you want to keep the EmptyMessage whenever you select an item from the RadComboBox. This is not a logical scenario anyway. That's why could you please explain in details what are you trying to achieve.

    Thank you!

    Greetings,
    Veronica Milcheva
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  4. Shrirang
    Shrirang avatar
    10 posts
    Member since:
    May 2009

    Posted 07 May 2010 Link to this post

    Hi,
              Thanks for the reply.
    See i have two items in my combo box Copy and Delete.

    when i select "Delete" form combo box it performs some delete operations and refresh the page.
    After performing delete operation i want too clear the selection and shows empty message in combo box.
    i tried clearSelection() method. But it doesn't work.it show "Delete" item as selected item.
    if i want perform Delete action again i cant do that because it doesn't fires any event as it is already selected.
    For that i want to show empty message in combo box.

    Let me know if you want any more information.
    Thanks



  5. Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 07 May 2010 Link to this post

    Hello Shrirang,

    Thanks for the explanation.

    EmptyMessage appears on blur if no item is selected. Here's the solution for this:

    function SetEmptyMessage(sender, args) {
               var cmb = $find("<%=RadComboBox1.ClientID %>");
               cmb.clearSelection();            
               sender.set_text("");
               cmb.set_emptyMessage("Select action");
               cmb.get_inputDomElement().blur();
               setTimeout(function () { cmb._focused = false; }, 0);
           }

    The last two rows cause the RadComboBox to blur.

    Find the full code in the attached .zip file and please let me know if this was helpful.

    Greetings,
    Veronica Milcheva
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  6. Hakan
    Hakan avatar
    12 posts
    Member since:
    Jul 2010

    Posted 13 Oct 2010 Link to this post

    cbCustomer.ClearSelection();

    cbCustomer.Text =

     

    string.Empty;

     

     

     

     

     

Back to Top