Server Side event OnClose?

2 posts, 0 answers
  1. Steven
    Steven avatar
    29 posts
    Member since:
    Jan 2013

    Posted 22 Jan 2013 Link to this post

    I have a RadComboBox with CheckBoxes set true.  How do I trigger a server side event when the ComboBox closes?
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 22 Jan 2013 Link to this post

    Hi Steven,

    You can add a HiddenField to track the changes in the RadComboBox and raise a button click based on the hidden field value. Here is the sample code.

    CSS:
    <style type="text/css">
        .HiddenButton
        {
            display: none;
        }
    </style>

    ASPX:
    <telerik:RadComboBox ID="RadComboBox1" runat="server" CheckBoxes="true" OnClientDropDownClosed="OnClientDropDownClosed" OnClientItemChecked= "OnClientItemChecked" >
      <Items>
          ............    
      </Items>
    </telerik:RadComboBox>
    <asp:Button ID="Button1" runat="server" onclick="Button1_Click" CssClass="HiddenButton" />
    <asp:HiddenField ID="HiddenField1" runat="server" />

    JS:
    <script type="text/javascript">
        function OnClientDropDownClosed(sender, args) {
            if (document.getElementById("HiddenField1").value == 1) {
                document.getElementById("HiddenField1").value = 0;
                document.getElementById("Button1").click();
            }
        }
        function OnClientItemChecked(sender, args) {
            document.getElementById("HiddenField1").value = 1;
        }
    </script>

    Hope this helps.

    Regards,
    Princy.
Back to Top