canceling postback of Radcombobox

2 posts, 0 answers
  1. Sunil
    Sunil avatar
    28 posts
    Member since:
    Feb 2011

    Posted 25 Jul 2011 Link to this post

    Dear Sir/Mam


    How can i make selection of combobox item after making its postback false

    ---------Javascript Function-----------------------------------------------
     function OnClientSelectedIndexChangingSeries(sender, args) {
                         var btnAdd = $find("<%=btnAdd.ClientID %>");
                         if (btnAdd.get_text() == "Add") {
                             args.set_cancel(false);                        
                         }
                         else {
                             args.set_cancel(true);                                              
                         }
     }
    --------------------------------------------------------------------------------
    ------------ASPX Page Combobox Control---------------------------------------
      <telerik:RadComboBox ID="cmbSeries" runat="server"  AutoPostBack="true"
                                        OnClientSelectedIndexChanging="OnClientSelectedIndexChangingSeries" / >       
    -----------------------------------------------------------------------------------------
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 25 Jul 2011 Link to this post

    Hello Sunil,

    I am not quite sure about the requirement. I suppose you want to access the SelectedItem. If that is the requirement, here is the sample code that I tried which worked as expected.
    JS:
    <script type="text/javascript">
    function OnClientSelectedIndexChangingSeries(sender, args)
    {
    var btnAdd = $find("<%=cmbSeries.ClientID %>");
    alert(btnAdd.get_text()) ;
    }
    </script>

    Also take a look at the following help documentation which explains more about this.
    Client-Side Basics.

    Thanks,
    Shinu.
Back to Top