+1-888-365-2779
Try Now
More in this section

Forums / 3.x Pre-release forums (retired) / ComboBox SelectedIndexChanged event does not fire on first AJAX request

ComboBox SelectedIndexChanged event does not fire on first AJAX request

5 posts, 0 answered
  1. Jason Grovert
    Jason Grovert avatar
    28 posts
    Registered:
    25 Oct 2005
    14 May 2007
    Link to this post
    We have a Web User Control that dynamically loads other Web User Controls as part of a Wizard style control.  One of the User Controls contains a ComboBox that performs a PostBack via AJAX to load data into another ComboBox.  When a value is selected the PostBack occurs but the Event does not fire on the first Request.  If the value is selected again the Event fires.  We have stepped through the code to check for errors or inadvertent calls to DataBind which could cause the event not to fire.  Furthermore, we have duplicated this functionality outside of our SiteFinity project using the r.a.d ComboBox and it works correctly.  We have also attempted to use a standard ASP.Net DropDownList control to eliminate the possibility of the problem being related to the ComboBox.

    We are using the Microsoft AJAX controls and MasterPages on this project.  The ScriptManager control is located on the MasterPage.  Both the Web User Controls each contain an UpdatePanel.

    This issue is preventing us from moving forward on this project.
  2. Vassil Daskalov
    Vassil Daskalov avatar
    261 posts
    Registered:
    18 May 2013
    17 May 2007
    Link to this post
    Hi Jason,

    I tried to reproduce your problem by creating a user control with two combo boxes which behave as described by you. It seems that everything works fine unless of course I am missing something. Therefore I am attaching the project I have created. Perhaps you could update it the way it should be and send it back.

    Thanks in advance for your cooperation.

    Regards,
    Vassil Daskalov
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Jason Grovert
    Jason Grovert avatar
    28 posts
    Registered:
    25 Oct 2005
    24 May 2007
    Link to this post
    The reason your sample works is because the r.a.d. ComboBox controls are not being loaded dynamically into your Web User Control.  To reproduce the problem you need to replace both of the ComboBox controls with a PlaceHolder control and a Button (or some other control that can initiate the CallBack) and load the ComboBox using the LoadControl() method.  Basically the problem amounts to the fact that the control (the ComboBox in this example) is being loaded during the PostBack which is what appears to be causing the problem.  The control apparently needs to be loaded when page is first visible (i.e. the initial load or PostaBack == false).  If this is not the case please let us know what else could be the cause.

    We tried a work around by using the RequestItems client-side method but when we attempt to set the ExternalCallBackPage property it defaults to "/sitefinity" and the root of the path and we cannot override that.  We need to be able to set the path as being either relative to root (which "/sitefinity" is not) or absolute.  I think this might be a bug with that control.
  4. Vassil Daskalov
    Vassil Daskalov avatar
    261 posts
    Registered:
    18 May 2013
    29 May 2007
    Link to this post
    Hello Jason Grovert,

    Please, accept my apologies for the delayed answer. I was trying to reproduce your problem in various ways to no avail unfortunately. With all the information in this thread I came up with two examples which are using the LoadControl method and I think are pretty close to the problem. I am attaching them. Please, take a look at them and see what I am missing.

    It would really be very helpful, less time consuming and much easier to reproduce your problem if you could send us some code. Thanks for your cooperation in advance. I hope we are moving in the right direction with this issue.

    Kind regards,
    Vassil Daskalov
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  5. Shahzad Ilyas
    Shahzad Ilyas avatar
    1 posts
    Registered:
    11 Feb 2010
    19 Oct 2011
    Link to this post
    Hi
    i had the same problem but i found the solution thanks to Shinu..:D

    Quote "One suggestion would be invoking postback from client side SelectionIndexChanged event of RadComboBox instead of setting the AutoPostBack property to True. Give a try with the following code."


    ASPX
    <telerik:RadComboBox ID="RadComboBox1" runat="server" AutoPostBack="false" AllowCustomText="True" OnSelectedIndexChanged="RadComboBox1_SelectedIndexChanged"
    OnClientSelectedIndexChanged="OnClientSelectedIndexChanged">
    <Items>
    <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem1" Value="RadComboBoxItem1">
    </telerik:RadComboBoxItem>
    </Items>
    </telerik:RadComboBox>


    JavaScript
    <script type="text/javascript">
    function OnClientSelectedIndexChanged(sender, args)
    {
    __doPostBack('RadComboBox1','');
    }
    </script>

    thank you so much shinu...
    regards
    Shaz
Register for webinar
5 posts, 0 answered