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

Rad combobox value not clear ?

1 Answer 75 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Aravind
Top achievements
Rank 2
Iron
Iron
Iron
Aravind asked on 05 Aug 2013, 07:32 AM
Hai Everyone,
  I have a problem in radcombobox.First i add the value in db whatever enter in combobox,then i click again same page i see the what value lastly enter in comobox .I need to remove lastly enter value in comobox.it behave like remember username and password.After logout it goes to login page and can see username and password enter in textbox,bcz we check remember password at first login.
here i attach the screen shot.  
in no.1 ,i enter value in comobox and save in db.
    no.2.if i click same page i clear the value of comobox in javascript and verify there is no value,but
    no 3.i see the lastly enter value in comobox.
So pls reply me how clear lastly enter value ? or in page load i need add some text like "--SELECT--" ?

Regards
  Aravind

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 06 Aug 2013, 11:50 AM
Hi Aravind,

I guess you are clearing the entire item in the RadComboBox on clear button click and you want to show "SELECT" as the EmptyMessage. Here is the complete code snippet I tried.

ASPX:
<telerik:RadComboBox ID="RadComboBox1" runat="server"  EmptyMessage="SELECT">
   <Items>
        <telerik:RadComboBoxItem Text="Item1" />
            <telerik:RadComboBoxItem Text="Item2" />
            <telerik:RadComboBoxItem Text="Item3" />
   </Items>
</telerik:RadComboBox>
<telerik:RadButton Text="clear" ID="RadButton1" runat="server"
         OnClientClicked="OnClick1" AutoPostBack="false">
</telerik:RadButton>

JavaScript:
function OnClick1(sender, args)
{
        var combobox = $find('<%=RadComboBox1.ClientID %>');
        combobox.trackChanges();
        combobox.get_items().clear();
        combobox.clearSelection();
        combobox.commitChanges();
}

Please provide your code and elaborate the scenario it it doesn't help.

Thanks,
Shinu.
Tags
ComboBox
Asked by
Aravind
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Shinu
Top achievements
Rank 2
Share this question
or