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

Timer and UpdatePanel causes full page postback

6 Answers 248 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Samuel
Top achievements
Rank 1
Samuel asked on 25 Mar 2009, 02:52 PM
I'm doing sharepoint development, and we have built a sharepoint page-layout template that contains a RadTabStrip with three tabs. In each of the three page views we have placed a web part zone.

The web part I am building now uses an UpdatePanel and a Timer to regularly refresh data that is being displayed to the user. When I drop this web part onto the default page layout (no TabStrips), the web part behaves perfectly. When I drop that part into any zone on the page that uses a layout with a RadTabStrip, the entire page refreshes whenever the timer ticks.

Here is how I have the tab strip defined in my page layout template:
<div class="standardPadding"
            <WebPartPages:WebPartZone ID="ReportTitleWebPartZone" runat="server" Title="loc:Report Title" 
                QuickAdd-GroupNames="Title" QuickAdd-ShowListsAndLibraries="false" FrameType="TitleBarOnly"
              <ZoneTemplate> 
              </ZoneTemplate> 
            </WebPartPages:WebPartZone> 
 
            <telerik:RadTabStrip runat="server" ID="RadTabStrip1" Orientation="HorizontalTop" Skin="CDSC" SelectedIndex="0" MultiPageID="RadMultiPage1" EnableEmbeddedSkins="false"
              <Tabs> 
                <telerik:RadTab Text="Gauge"></telerik:RadTab> 
                <telerik:RadTab Text="Bar Chart"></telerik:RadTab> 
                <telerik:RadTab Text="Trend"></telerik:RadTab> 
              </Tabs> 
            </telerik:RadTabStrip> 
 
            <telerik:RadMultiPage runat="server" ID="RadMultiPage1" SelectedIndex="0"
              <telerik:RadPageView runat="server" ID="RadPageView1"
                <WebPartPages:WebPartZone ID="WebPartZoneIn1" runat="server" Title="loc:Horizontal Row" 
                QuickAdd-GroupNames="Content" QuickAdd-ShowListsAndLibraries="false" FrameType="TitleBarOnly" /> 
              </telerik:RadPageView> 
              <telerik:RadPageView runat="server" ID="RadPageView2"
                <WebPartPages:WebPartZone ID="WebPartZoneIn2" runat="server" Title="loc:Horizontal Row" 
                                QuickAdd-GroupNames="Title" QuickAdd-ShowListsAndLibraries="false" FrameType="TitleBarOnly" /> 
              </telerik:RadPageView> 
              <telerik:RadPageView runat="server" ID="RadPageView3"
                <WebPartPages:WebPartZone ID="WebPartZoneIn3" runat="server" Title="loc:Horizontal Row" 
                                QuickAdd-GroupNames="Content" QuickAdd-ShowListsAndLibraries="false" FrameType="TitleBarOnly" /> 
              </telerik:RadPageView> 
            </telerik:RadMultiPage> 
            
             
            <WebPartPages:WebPartZone ID="WebPartZone9" runat="server" Title="loc:Horizontal Row" 
                QuickAdd-GroupNames="Footer" QuickAdd-ShowListsAndLibraries="false" FrameType="TitleBarOnly"
              <ZoneTemplate> 
              </ZoneTemplate> 
            </WebPartPages:WebPartZone> 
          </div> 

And here is a dummy web part that perfectly recreates the issue I'm seeing:

    public class DummyWebPart : WebPart 
    { 
        protected override void CreateChildControls() 
        { 
            UpdatePanel p = new UpdatePanel(); 
            p.UpdateMode = UpdatePanelUpdateMode.Always; 
            this.Controls.Add(p); 
 
            Label l = new Label(); 
            l.Text = DateTime.Now.ToString(); 
            p.ContentTemplateContainer.Controls.Add(l); 
 
            Timer t = new Timer(); 
            t.Enabled = true
            t.Interval = 15000; 
            p.ContentTemplateContainer.Controls.Add(t); 
            t.Tick += new EventHandler<EventArgs>(t_Tick); 
        } 
 
        void t_Tick(object sender, EventArgs e) 
        { 
            // nothing 
        } 
    } 




Can you give me any suggestions for how to resolve this issue?

6 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 25 Mar 2009, 02:58 PM
Hi Samuel,

Please check this blog post which discusses how to enable ajax in SharePoint. Look for the "Using UpdatePanels within SharePoint" section.

Sincerely yours,
Albert
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Samuel
Top achievements
Rank 1
answered on 25 Mar 2009, 03:11 PM
I'm afraid you have misunderstood my question.

When the web part I supplied is dropped into any other web part page on my sharepoint site, it works fine. It only displays this behavior when it is dropped onto a page that uses a layout template that has a RadTabStrip on it.
0
Atanas Korchev
Telerik team
answered on 25 Mar 2009, 03:25 PM
Hi Samuel,

Did you try the suggested workaround? Does it work? This is the only reason we are aware of which may create postbacks in sharepoint instead of ajax calls. Here is the required code:

<script type='text/javascript'>_spOriginalFormAction = document.forms[0].action; _spSuppressFormOnSubmitWrapper=true;</script>


Regards,
Albert
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Samuel
Top achievements
Rank 1
answered on 25 Mar 2009, 03:43 PM
Yes, we are using this technique. As I have stated before, we do not run into any issues on any pages other than those which have the Telerik TabStrip and MultiPage in the page layout template.
0
Samuel
Top achievements
Rank 1
answered on 25 Mar 2009, 03:48 PM
We have just discovered another clue which may help solve the problem. I dropped a different AJAX-enabled web part onto the page with the issue. This part uses a button as a trigger rather than a Timer. It performs as expected. Thus, the issue seems to be related solely to the way the timer, UpdatePanel, and tab strip all interact.
0
Atanas Korchev
Telerik team
answered on 25 Mar 2009, 04:48 PM
Hi Samuel,

I couldn't reproduce the issue on my end. First I created a simple web part using the provided code. Without this script block in the master page it posted back instead of making ajax requests:

<script type='text/javascript'>_spOriginalFormAction = document.forms[0].action; _spSuppressFormOnSubmitWrapper=true;</script>

After adding it everything went back to normal. Then I added the webart zone declarations with the tabstrip. Still everything was working fine. I have attached all files to this thread.

All the best,
Albert
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
TabStrip
Asked by
Samuel
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Samuel
Top achievements
Rank 1
Share this question
or