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

how combobox reset after postback

1 Answer 91 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Rahul
Top achievements
Rank 1
Rahul asked on 11 Jan 2014, 08:41 AM
how show empty message in combo box after post back page.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 13 Jan 2014, 03:25 AM
Hi Rahul,

Please have a look into the following code snippet to achieve your scenario.

ASPX:
<telerik:RadComboBox ID="RadComboBox1" runat="server" AutoPostBack="true">
    <Items>
        <telerik:RadComboBoxItem Text="Item1" />
        <telerik:RadComboBoxItem Text="Item2" />
        <telerik:RadComboBoxItem Text="Item3" />
    </Items>
</telerik:RadComboBox>

One option is that you can set the EmptyMessage on the pageLoad event as follows.
JavaScript:
<script type="text/javascript">
    function pageLoad() {
        var combo = $find("<%=RadComboBox1.ClientID %>");
        combo.clearSelection();
        combo.set_emptyMessage("select");
    }
</script>

Another option is that you can set it from the server side Page_Load event as follows.
C#:
protected void Page_Load(object sender, EventArgs e)
{
    RadComboBox1.ClearSelection();
    RadComboBox1.EmptyMessage = "--select--";
}

Hope this will helps you.
Thanks,
Shinu.
Tags
ComboBox
Asked by
Rahul
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or