Best practice for disabling javascript postback problem?

2 posts, 1 answers
  1. Sean
    Sean avatar
    200 posts
    Member since:
    Nov 2010

    Posted 02 Mar 2011 Link to this post

    Hi Telerik,

    So, I encountered the issue where I would change a RadComboBox's selection programmatically client-side and it would trigger a postback when unwanted.

    I came up with this solution, but I do not know if this is best practice. If not, what other options do I have? If so, cheers to anyone else who can use it.

    1) Turn RadComboBox autopostback to false.

    <script type="text/javascript">
        var doPostback = true;
        function pageLoad() {
            doPostback = false;
            $find("<%= RadComboBox1.ClientID %>").findItemByValue("YourItemHere").select();
            doPostback = true;
          function OnClientSelectedIndexChanged(sender, eventArgs) {
              if (doPostback) {
                  __doPostBack('RadComboBox1', '');
  2. Answer
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 03 Mar 2011 Link to this post

    Hello Sean,

    You should be able to accomplish this scenario with the help of RadAjaxManager as well.

    <telerik:RadAjaxManager  ID="RadAjaxManager1"  runat="server"  OnAjaxRequest="RadAjaxManager1_AjaxRequest">

    function postBack(sender, args)
       var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");
      ajaxManager.ajaxRequestWithTarget('<%= RadComboBox1.UniqueID %>', '');

    And also check this code library which follows the __doPostBack method for raising the postback..
    RadComboBox - Allow only certain items to postback

Back to Top