how combobox reset after postback

2 posts, 0 answers
  1. Rahul
    Rahul avatar
    39 posts
    Member since:
    Jan 2014

    Posted 11 Jan 2014 Link to this post

    how show empty message in combo box after post back page.

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 12 Jan 2014 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top