This is a migrated thread and some comments may be shown as answers.

UpdatePanelsRenderMode Problems

6 Answers 122 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
ManniAT
Top achievements
Rank 2
ManniAT asked on 10 Apr 2009, 04:00 PM
Hi,

first of all I have the following problem:
I use a RadProxy in a Usercontrol. It is not possible to set UpdatePanelsRenderMode declarative on the proxy.
I can set it programatically BUT - this overrides the Manager settings.
So what if I need Inline in my control - but the Controls user wants to have block?

The next problem is really a problem (bug?) - or I do something wrong.
Assume a usercontrol which has 3 controls that should be updated via an async call to the manager.
If I do this inline it would look like this:
<telerik:RadAjaxManager ID="ramManager" runat="server" DefaultLoadingPanelID="alpPan1" > 
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="ramManager">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="lblCurDir" /> 
                    <telerik:AjaxUpdatedControl ControlID="lblCurFile" /> 
                    <telerik:AjaxUpdatedControl ControlID="imgPreview" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
        </AjaxSettings> 
    </telerik:RadAjaxManager> 
Now I use these things in a usercontrol - using a proxy.
Therefore I have to set the things in code.
I could do this:
            RadAjaxManager aM = RadAjaxManager.GetCurrent(Page);  
            if (aM == null) {  
                Response.Write("XFileExplorer needs an ajax manager in the page holding the control!");  
                Response.End();  
                return;  
            }  
            //calling ajax function changes grid and hidden fields - so add settings  
            aM.AjaxSettings.AddAjaxSetting(aM, hfCurDir);  
            aM.AjaxSettings.AddAjaxSetting(aM, hfCurFile);  
            aM.AjaxSettings.AddAjaxSetting(aM, rgBackupFiles);  
            aM.UpdatePanelsRenderMode = UpdatePanelRenderMode.Inline;  
 
But this (I gues would be equivalent to):
    <telerik:RadAjaxManager ID="ramManager" runat="server" DefaultLoadingPanelID="alpPan1" > 
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="ramManager">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="lblCurDir" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
            <telerik:AjaxSetting AjaxControlID="ramManager">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="lblCurFile" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
            <telerik:AjaxSetting AjaxControlID="ramManager">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="imgPreview" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
        </AjaxSettings> 
    </telerik:RadAjaxManager> 
 
So I decided to "block" the things like this:
            AjaxSetting aS = new AjaxSetting(aM.ID);  
            string strLoadPanelID=aM.DefaultLoadingPanelID; //use default loading panel  
            aS.UpdatedControls.Add(new AjaxUpdatedControl(rgBackupFiles.ID, strLoadPanelID));  
            aS.UpdatedControls.Add(new AjaxUpdatedControl(hfSaveCurDir.ID,strLoadPanelID));  
            aS.UpdatedControls.Add(new AjaxUpdatedControl(hfSaveCurFile.ID,strLoadPanelID));  
            aM.AjaxSettings.Add(aS);  
            aM.UpdatePanelsRenderMode = UpdatePanelRenderMode.Inline;  
 
This works (controls are updated) - BUT I loose Inline Render mode!
No problem for the hidden fields - but a problem with the grid.

My workaround:
            //calling ajax function changes grid and hidden fields - so add settings  
            AjaxSetting aS = new AjaxSetting(aM.ID);  
            string strLoadPanelID=aM.DefaultLoadingPanelID; //use default loading panel  
            //CANT DO THIS - WOULD REMOVE RENDER MODE aS.UpdatedControls.Add(new AjaxUpdatedControl(rgBackupFiles.ID, strLoadPanelID));  
            aS.UpdatedControls.Add(new AjaxUpdatedControl(hfSaveCurDir.ID,strLoadPanelID));  
            aS.UpdatedControls.Add(new AjaxUpdatedControl(hfSaveCurFile.ID,strLoadPanelID)); //add extra to preserver inline mode  
            aM.AjaxSettings.Add(aS);  
            aM.UpdatePanelsRenderMode = UpdatePanelRenderMode.Inline;  
            aM.AjaxSettings.AddAjaxSetting(aM, rgBackupFiles);  
 

Am I doing something wrong?

Regards

Manfred

6 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 13 Apr 2009, 02:12 PM
Hi ManniAT,

UpdatePanelsRenderMode can be applied either to ALL updated controls (if you set it to the RadAjaxManager) or just to ONE updated control (if you set it programmatically in AjaxSettingCreated).

Please review the attached example.

Sincerely yours,
Dimo
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
ManniAT
Top achievements
Rank 2
answered on 13 Apr 2009, 02:30 PM
Hi Dimo,

(just to proof that I understood you correctly) so this means that for my sample I:
a.) can use the "blocked insert"
BUT
b.) than I have to call the code shown in your ASPX - for every control contained in the block.

This opens two questions:
a.) Why isn't the Rendermode part of the "UpdatedControl" - since I can (or in my case have to) set it there?
b.) Is it really an "design approach" that adding a block eliminates the setting?

For b.) forget about the need to set the things specific - simply I want to add a "block of controls" (or better described
add an Ajax Setting with multiple Updated Controls).
And this changes the rendering mode (or ignores it) - which I think is not intended.

Conclusion (please correct me if I'm wrong):
My problem having an APSX with "special rendering mode" - can be solved with a script which set's the rendering for every updated control on the proxy.
So I stay independent of the set rendering mode on the "containing page".
--Should be documented somewhere - of much better (if possible) provided as property of "UpdatedControl".
AND
Adding an Ajax setting like in this code
  AjaxSetting aS = new AjaxSetting(aM.ID);     
            string strLoadPanelID=aM.DefaultLoadingPanelID; //use default loading panel     
            aS.UpdatedControls.Add(new AjaxUpdatedControl(rgBackupFiles.ID, strLoadPanelID));     
            aS.UpdatedControls.Add(new AjaxUpdatedControl(hfSaveCurDir.ID,strLoadPanelID));     
            aS.UpdatedControls.Add(new AjaxUpdatedControl(hfSaveCurFile.ID,strLoadPanelID));     
            aM.AjaxSettings.Add(aS);       
    
 
overrides the UpdatePanelsRenderMode (or at least ignores it) which is a "bug" - or (at least) a "strange behavior" which should be documented.

Regards

Manfred
PS: although the thing with adding an AjaxSetting has a bitter Taste - I thank you very much for the answer since it provides me with a way to have my usercontrols independent of the parents render mode.
0
Dimo
Telerik team
answered on 13 Apr 2009, 02:49 PM
Hello,

We will consider adding the UpdatePanelsRenderMode property per updated control in the future.

I am afraid I did not understand in what case exactly the property gets ignored and what is "block insert", so feel free to send a complete runnable example in a new support ticket.

Kind regards,
Dimo
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
ManniAT
Top achievements
Rank 2
answered on 13 Apr 2009, 03:34 PM
Hi,

sorry for confusion - please take a look at my initial post.
I set the updatepanelmode there to inline.
This works fine.

Now I use an ASCX usercontrol with a proxy.
I add some controls
  RadAjaxManager aM = RadAjaxManager.GetCurrent(Page);     
            if (aM == null) {     
                Response.Write("XFileExplorer needs an ajax manager in the page holding the control!");     
                Response.End();     
                return;     
            }     
            //calling ajax function changes grid and hidden fields - so add settings     
            aM.AjaxSettings.AddAjaxSetting(aM, hfCurDir);     
            aM.AjaxSettings.AddAjaxSetting(aM, hfCurFile);     
            aM.AjaxSettings.AddAjaxSetting(aM, rgBackupFiles);     
            aM.UpdatePanelsRenderMode = UpdatePanelRenderMode.Inline;     
    
 
This works OK.

I guess it produces several AjaxSettings like so:
 <telerik:RadAjaxManager ID="ramManager" runat="server" DefaultLoadingPanelID="alpPan1" >    
        <AjaxSettings>    
            <telerik:AjaxSetting AjaxControlID="ramManager">     
                <UpdatedControls>    
                    <telerik:AjaxUpdatedControl ControlID="lblCurDir" />    
                </UpdatedControls>    
            </telerik:AjaxSetting>    
            <telerik:AjaxSetting AjaxControlID="ramManager">     
                <UpdatedControls>    
                    <telerik:AjaxUpdatedControl ControlID="lblCurFile" />    
                </UpdatedControls>    
            </telerik:AjaxSetting>    
            <telerik:AjaxSetting AjaxControlID="ramManager">     
                <UpdatedControls>    
                    <telerik:AjaxUpdatedControl ControlID="imgPreview" />    
                </UpdatedControls>    
            </telerik:AjaxSetting>    
        </AjaxSettings>    
    </telerik:RadAjaxManager>    
 
To have one single setting instead I do the following:
 AjaxSetting aS = new AjaxSetting(aM.ID);     
            string strLoadPanelID=aM.DefaultLoadingPanelID; //use default loading panel     
            aS.UpdatedControls.Add(new AjaxUpdatedControl(rgBackupFiles.ID, strLoadPanelID));     
            aS.UpdatedControls.Add(new AjaxUpdatedControl(hfSaveCurDir.ID,strLoadPanelID));     
            aS.UpdatedControls.Add(new AjaxUpdatedControl(hfSaveCurFile.ID,strLoadPanelID));     
            aM.AjaxSettings.Add(aS);     
            aM.UpdatePanelsRenderMode = UpdatePanelRenderMode.Inline;     
 
This is what I mean with "block" :)
And this does result in rendermode block for the added control.
No matter if I set the mode here in code to inline or if I do it in the AjaxManager declarative.

About a running sample - I uploaded a sample to the Code Library - I guess you have access to it (it's under screening at the momen).
This sample include a usercontrol - XFileExplorer.axcx - In the page_load you will find
            AjaxSetting aS = new AjaxSetting(aM.ID);  
            string strLoadPanelID=aM.DefaultLoadingPanelID; //use default loading panel  
            //the next does not work -- it makes problems with UpdatePanelRenderMode  
            //aS.UpdatedControls.Add(new AjaxUpdatedControl(rgBackupFiles.ID, strLoadPanelID));  
            aS.UpdatedControls.Add(new AjaxUpdatedControl(hfSaveCurDir.ID,strLoadPanelID));  
            aS.UpdatedControls.Add(new AjaxUpdatedControl(hfSaveCurFile.ID,strLoadPanelID));  
            aM.AjaxSettings.Add(aS);  
            aM.UpdatePanelsRenderMode = UpdatePanelRenderMode.Inline;  
            aM.AjaxSettings.AddAjaxSetting(aM, rgBackupFiles);  
 
Simply change the code (I left it in comment to this:
            AjaxSetting aS = new AjaxSetting(aM.ID);  
            string strLoadPanelID=aM.DefaultLoadingPanelID; //use default loading panel  
            //the next does not work -- it makes problems with UpdatePanelRenderMode  
//COMMENT REMOVED  
            aS.UpdatedControls.Add(new AjaxUpdatedControl(rgBackupFiles.ID, strLoadPanelID));  
            aS.UpdatedControls.Add(new AjaxUpdatedControl(hfSaveCurDir.ID,strLoadPanelID));  
            aS.UpdatedControls.Add(new AjaxUpdatedControl(hfSaveCurFile.ID,strLoadPanelID));  
            aM.AjaxSettings.Add(aS);  
            aM.UpdatePanelsRenderMode = UpdatePanelRenderMode.Inline;  
            // comment this out aM.AjaxSettings.AddAjaxSetting(aM, rgBackupFiles);  
 
And you will see that the grid renders in panel mode instead of inline.

Regards

Manfred
0
Dimo
Telerik team
answered on 13 Apr 2009, 04:47 PM
Hello,

I am afraid I could not reproduce the unexpected behavior - please see the attached sample project. The update panel which wraps the grid has a display:inline style, i.e. the UpdatePanelsRenderMode is Inline.

Regards,
Dimo
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
ManniAT
Top achievements
Rank 2
answered on 13 Apr 2009, 05:16 PM
Hi,

I'm afraid an can also no longer reproduce this :)

Sorry for that.
I tested your code - it worked.
To proof my problems I setup the video recording environment - started VS - made the change - it worked.
I also messed around a lot with the setting and so -- it kept working.

So I guess there was another error before. (Made by me :)).

I can no longer reproduce the problem - and so this is solved for me.
Again - I'm really sorry that I wasted your time - and thank you for the excellent support.

Regards

Manfred
Tags
Ajax
Asked by
ManniAT
Top achievements
Rank 2
Answers by
Dimo
Telerik team
ManniAT
Top achievements
Rank 2
Share this question
or