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

Combox Empty Message

5 Answers 154 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Shrirang
Top achievements
Rank 1
Shrirang asked on 06 May 2010, 10:18 AM
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

 

5 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 06 May 2010, 01:42 PM
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.
0
Veronica
Telerik team
answered on 06 May 2010, 02:07 PM
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.
0
Shrirang
Top achievements
Rank 1
answered on 07 May 2010, 05:46 AM
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



0
Veronica
Telerik team
answered on 07 May 2010, 03:48 PM
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.
0
Hakan
Top achievements
Rank 1
answered on 13 Oct 2010, 02:50 PM

cbCustomer.ClearSelection();

cbCustomer.Text =

 

string.Empty;

 

 

 

 

 

Tags
ComboBox
Asked by
Shrirang
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Veronica
Telerik team
Shrirang
Top achievements
Rank 1
Hakan
Top achievements
Rank 1
Share this question
or