This is a migrated thread and some comments may be shown as answers.
RadComboBox postback with the same content
1 Answer 24 Views
This is a migrated thread and some comments may be shown as answers.
Jhonny
Top achievements
Rank 1
Jhonny asked on 18 Feb 2013, 08:56 PM
Hello, how I can make a RadComboBox do postback
That each time you press the ENTER key.

When I have the same content does not postback.

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 20 Feb 2013, 05:45 AM
Hi Jhony

Try the following markup and JS to achieve your scenario.
aspx:
<telerik:RadComboBox ID="RadComboBox1" runat="server" OnClientKeyPressing="OnClientKeyPressing" OnClientFocus="OnClientFocus">
    <Items>
        <telerik:RadComboBoxItem Text="001" Selected="true" />
        <telerik:RadComboBoxItem Text="002" />
        <telerik:RadComboBoxItem Text="003" />
    </Items>
</telerik:RadComboBox>
JS:
<script type="text/javascript">
var comboText;
function OnClientFocus(sender, args)
{
    comboText = sender.get_text();
}
function OnClientKeyPressing(sender, args)
{
    if (comboText == sender.get_text())
    {
    //No postback
    }
    else
    {
        if (args.get_domEvent().keyCode == 13)
        {
            __doPostBack();
        }
    }
}
</script>

Thanks
Princy
Asked by
Jhonny
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Share this question
or