Control bind order changed with RadAjaxManager?

7 posts, 0 answers
  1. Charles Forsyth
    Charles Forsyth avatar
    47 posts
    Member since:
    Sep 2006

    Posted 23 Sep 2008 Link to this post

    I have a fairly simple page that contains a DropDownList control and a DetailsView control in a master/details type setup.

    The DetailsView displays the details of the record selected in the DropDownList.

    This form works perfectly without RadAjaxManager.

    However, as soon as I hook up the RadAjaxManager I get errors in the code.

    Troubleshooting the issue I was able to determine that the DetailsView.DataBound event is being triggered BEFORE the DropDownList.DataBound event. Code in the DetailsView.DataBound event populates a control within the DetailsView with data associated with the currently selected item in the DropDownList. But an error occurs because there is no DropDownList.SelectedValue because the DropDownList control hasn't been databound yet.

    As I said, this does not occur when RadAjaxManager is not on the page.

    What do I need to set in RadAjaxManager to make sure that the controls get bound in the correct order? (top-down)

    Note I've hooked up event handlers for DetailsView.ModeChanged and DetailsView.DataBound. Also note I've hooked up the DropDownList.PreRender event as well with the following code:

    CType(sender, DropDownList).Attributes.Add("onChange""window.focus();")


    I need to have this code because the user may use his mouse wheel to scroll the page, but if the DropDownList is selected it will scroll that instead and reload the DetailsView.

  2. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 26 Sep 2008 Link to this post

    Hello Charles,

    I followed your scenario in order to replicate the issue, but no avail. Please find attached a sample and try it on your side. Let me know if it works as desired and what differs in your case.

    Best wishes,
    Iana
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Charles Forsyth
    Charles Forsyth avatar
    47 posts
    Member since:
    Sep 2006

    Posted 26 Sep 2008 Link to this post

    Thanks for your reply.

    I had to convert that project to .Net 3.5 because I'm using Visual Studio 2008.

    However, it was no suprise that the extremely simple example you threw together (without a master page), works as expected.

    Since my original post, I've solved the problem by adding:

    DetailsView1.DataBind()

    to the DropDownList1.DataBound event

    ...and:

    If DropDownList1.SelectedIndex < 0 Then

    Exit Sub

    End If

    to the DetailsView.DataBound event

    I found it EXTREMELY odd that the DropDownList, at early run-time, didn't have a SelectedIndex because a DropDownList by nature always has at least one selected. But the code above fixes the issue by skipping the other code I have in the DetailsView.DataBound event if the DropDownList doesn't have a selection yet. (because that code requires the DropDownList to have a selection)

    One question, in your sample the RadAjaxManager is at the bottom of the declarative page, I have mine at the top, would that make a difference?

    I'm also using RadAjaxManagerProxy because mine is in a Master Page and RadAjaxManager is in my MasterPage.master page. Would that make a difference?

  4. Charles Forsyth
    Charles Forsyth avatar
    47 posts
    Member since:
    Sep 2006

    Posted 28 Sep 2008 Link to this post

    I have submitted a support request and attached a project that demonstrates the problem.

    Upon further investigation it appears that the order in which control events occur in the page is changed only when RadAjaxManagerProxy is used (within a content page that utilizes a MasterPage that contains the RadAjaxManager control). The order of the events does not change when in a normal page that has the RadAjaxManager hooked up (not using a MasterPage)

    Since posting my support ticket, I have added trace logs in the events for the DropDownList and DetailsView. It is clear by the trace logs that the DataBound event of the DetailsView triggers prior to the DataBound event of the DropDownList. But this occurs ONLY when RadAjaxManagerProxy is hooked up. When not used, DataBound events for the controls on the page trigger in top-down order as expected.

    This evidence is what makes me assume that this is a defect within the RadAjaxManagerProxy control.
  5. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 29 Sep 2008 Link to this post

    Hi Charles Forsyth,

    Thank you for sending a sample demonstrating the issue. I will have a look at it and turn back to you with my findings.

    Additionally, you can find more information about RadAjax in master/content page scenarios here.

    Best wishes,
    Iana
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  6. Artem
    Artem avatar
    4 posts
    Member since:
    Aug 2012

    Posted 26 Oct 2011 Link to this post

    I have the same issue as described by Charles and I'm using the 2011 Q2 version of controls for .NET 3.5.
    Is this a confirmed defect?
  7. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 27 Oct 2011 Link to this post

    Hi Artem,

    Th issue was confirmed and appeared to be a limitation of RadAjaxManager. However can you try using RadAjaxPanel or ASP:UpdatePanel for ajaxifying the page and see if you observe different behavior?

    All the best,
    Iana Tsolova
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Back to Top