
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.
6 Answers, 1 is accepted
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.

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?

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.
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.

Is this a confirmed defect?
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