For some months now we have been working on a large .NET application that will serve as the Proposal Development System for our company. Because the methods of developing proposals vary significantly between the Eastern and Western divisions of our company, we have developed some of our pages to display Eastern or Western versions of themselves depending on the location of the user. This is accomplished by first determining the user’s location and then by loading appropriate user controls (.ascx) depending on that location.
In our application we have a web page (.aspx) which, in turn contains an update panel. This update Panel contains a placeholder into which an appropriate user control (Eastern or Western) will eventually be loaded. The main .aspx page also contains a checkbox which, when checked will indicate that some of the buttons on the screen need to be disabled. One of these buttons is actually contained in the user control.
In addition to the button, the .ascx controls also contains a RadGrid. In both Eastern and Western .ascx controls the RadGrids are named WBSGrid.
Finally the .aspx page contains both a ScriptManager ( actually a ScriptManagerProxy, as the actual ScriptManager is contained in our Master Page) and a RadAjaxManager.
The Update Panel in the .aspx document is defined as follows:
<asp:UpdatePanel ID="WBSUpdatePanel" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Panel ID="pnlWBSControls" runat="server"
Style="padding: 5px;"
ScrollBars="None">
<asp:PlaceHolder ID="phPnlWBSControls" runat="server"></asp:PlaceHolder>
</asp:Panel>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ckbLocked" />
</Triggers>
</asp:UpdatePanel>
Notice the placeholder, phpnlWBSControls, where we will load our ascx controls. The trigger is required to allow the contents of the Update Panel to be re-rendered when the trigger changes.
There is also a RadAjaxManager in the .aspx document which references WBSGrid and is defined as follows:
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="TeamMembersGrid" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="TeamMembersGrid">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="TeamMembersGrid" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="WBSGrid" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="WBSGrid">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="WBSGrid" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
Here is our problem:
1. Let’s presume, for the moment, that we start with the checkbox not checked. If, for the life of the event in which the page participates, we do not check it, the page performs flawlessly.
2. If we check the checkbox, the following problems crop up:
a. The button we are trying to disable in the user control is disabled. However we also want to hide the Command Item Display of the Grid and this does not happen
b. We receive an ajaxified error message ‘A Control is already associated with the element’ – we believe the ‘element’ to be the RadGrid from the user control.
c. If we then attempt (within the same session) to make any alterations within the RadGrid the display becomes corrupted. Essentially all of the headings within the RadGrid are shifted to the far right of the page with all of the rows within the grid being shifted to the far left of the page.
d. If we try to add a new record to the grid using the Command Item Display that we had tried to hide, the add fails silently and we see the corrupted screen described earlier.
e. If we leave the checkbox checked, navigate away from the page in question, and come back in with the same transaction, the RadGrid’s rendering and behavior seem to be corrected.
f. If after doing step e we uncheck the checkbox we receive the error mentioned in step b and the RadGrid reverts back to it’s unusual behavior.
3. If I comment out the line of code that tries to hide the Command Item Display within the RadGrid, the error message from item c persists but the RadGrid does not get corrupted.
4. Removing the Triggers note from the Update Panel and/or changing the Update Mode to ‘Always’ does not correct the problem.
Can you suggest a solution?