Rad Ajax Panel First Time Post Back

6 posts, 1 answers
  1. divya sahu
    divya sahu avatar
    16 posts
    Member since:
    Oct 2009

    Posted 08 Dec 2009 Link to this post

    Hello,
               I am working in sharepoint moss site.I have created one web part. In my web part i am using Rad Ajax Panel with some ASP.net controls. I am using <asp:panel> and  <asp:LinkButton>  and rad rotator , inside Rad Ajax Panel. My problem is that ,when i click on any link button first time , the PAGE is getting full post back.After that it behaves as expected.

    Following is my code:-

    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
    <table width="652" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td align="left" valign="top" scope="col"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td align="left" valign="top" scope="col" class="prismbannerTopleft"></td>
            <td align="left" valign="top" scope="col" class="prism_bannerTopMiddle"></td>
            <td align="left" valign="top" scope="col" class="prismbannerTopRight"></td>
          </tr>
          <tr>
            <td align="left" valign="top" scope="col" class="prism_bannerMiddleleft">&nbsp;</td>
            <td align="left" valign="top" scope="col" >
          
     <telerik:RadRotator ID="rrMonths" runat="server" AutoPostBack="false"
        OnItemDataBound="rrMonths_ItemDataBound" ScrollDuration="2000" >
       <ItemTemplate>
          <asp:Image AlternateText="IMAGE" ID="Image2" runat="server" ImageUrl='<%#DataBinder.Eval(Container.DataItem, "Image") %>'/>
       <asp:HiddenField ID ="hdnid" runat ="server" Value='<%# DataBinder.Eval(Container.DataItem, "Id") %>' />
          </ItemTemplate>
      </telerik:RadRotator>

            </td>
          <td align="left" valign="top" scope="col" class="prism_bannerMiddleRight">&nbsp;</td>
          </tr>
            <tr>
            <td align="left" valign="top" scope="col" class="prism_bannerBottomleft"></td>
            <td align="left" valign="middle" scope="col" class="prismbannerBottomtext">
            
       <table width="100%" border="0" cellspacing="0" cellpadding="0">
           <tr>
              <td width="72%" height="30" align="right" valign="middle" scope="col">
                    <asp:Panel runat="server" ID="PanelNumber" Width="200" HorizontalAlign="Right">
                       <asp:LinkButton ID="lnkdemo1" runat="server">1</asp:LinkButton> <br/>
                       <asp:LinkButton ID="lnkdemo2" runat="server">2</asp:LinkButton><br/>
                       <asp:LinkButton ID="lnkdemo3" runat="server">3</asp:LinkButton><br/>
                       <asp:LinkButton ID="lnkdemo4" runat="server">4</asp:LinkButton><br/>
                       <asp:LinkButton ID="lnkdemo5" runat="server">5</asp:LinkButton><br/>
                 </asp:Panel>
              </td>
          </tr>
       </table>
    </td>
    <td align="left" valign="top" scope="col" class="prism_bannerBottomRight"></td>
    </tr>
    </table></td>
      </tr>
    </table>
    </telerik:RadAjaxPanel>


    If you have any solution regarding my problem ,send me ASAP.
    Thanks in Advance.
  2. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 11 Dec 2009 Link to this post

    Hello divya,

    Could you please specify how the problematic web part is loaded? Is it declaratively added on the page or you are loading it dynamically?


    Kind regards,
    Iana
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. divya sahu
    divya sahu avatar
    16 posts
    Member since:
    Oct 2009

    Posted 11 Dec 2009 Link to this post

    Thanks for Reply,
    Following code i am using to load my webpart ,  In my web part inside .cs file ,using following function.

    protected

     

    override void CreateChildControls()

     

    {

     

    try

     

    {

     

    UC_Rotator UCRotator = (UC_Rotator)this.Page.LoadControl(@"~/_CONTROLTEMPLATES/Smithsonian Controls/UC_Rotator.ascx");

     

    UCRotator.ID =

    "UCRotator";

     

    UCRotator.Rheight =

    this.Rheight;

     

    UCRotator.Rwidth =

    this.Rwidth;

     

    UCRotator.Itemheight =

    this.Itemheight;

     

    UCRotator.Itemwidth =

    this.Itemwidth;

     

    UCRotator.Home =

    this.Home;

     

     

    this.Controls.Add(UCRotator);

     

    ViewState[

    "demo"] = "true";

     

     

    //base.CreateChildControls();

     

    }

     

    catch (Exception oEx)

     

    {

     

    HttpContext.Current.Response.Write("Create child control: " + oEx.Message);

     

    }

    }


  4. Answer
    Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 14 Dec 2009 Link to this post

    Hi divya,

    In this case I suggest that you ajaxify the problematic web part using RadAjaxManager instead of RadAjaxPanel. For that purpose, you need to add the RadAjaxManager in the OnInit event handler as shown below. Then you can wrap the web part content into an ASP:Panel and ajaxify it by adding the ajax settings dynamically on Load or PreRender event.

    RadAjaxManager ajaxManager = RadAjaxManager.GetCurrent(this.Page);
    if (ajaxManager == null)
    {
       ajaxManager = new RadAjaxManager();
       ajaxManager.ID = "RadAjaxManager1";
       this.Page.Form.Controls.Add(ajaxManager);
       this.Page.Items.Add(typeof(RadAjaxManager), ajaxManager);
    }

    Give it a try and let me know if it makes any difference. 

    Kind regards,
    Iana
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. divya sahu
    divya sahu avatar
    16 posts
    Member since:
    Oct 2009

    Posted 17 Dec 2009 Link to this post

    Thank u so much !! this helped me a lot. My problem has solved I added Rad Ajax panel dynamically in my program under  OnLoad event. Following code worked for me.

     

    protected override void OnLoad(EventArgs e)

    {

                try

                {

                    base.OnLoad(e);

                    _updatePanel = new RadAjaxPanel();

                    _updatePanel.ID = "UpdatePanel1";

                    this.Controls.Add(_updatePanel);

                    Panel pnlsearch = (Panel)UCRotator.FindControl("demo");

                    _updatePanel.Controls.Add(pnlsearch);

                  

     

                }

                catch (Exception ex)

                {

                     HttpContext.Current.Response.Write("Error :" + ex.Message);

              }

    }

     

     

    protected override void OnInit(EventArgs e)

            {

                base.OnInit(e);

                if (ScriptManager.GetCurrent(this.Page) == null)

                {

                    ScriptManager managers = new RadScriptManager();

                    this.Page.Form.Controls.AddAt(0, managers);

                }

            }

     

     

     private void EnsureUpdatePanelFixups()

            {

                if (this.Page.Form != null)

                {

                    String fixupScript = @"_spBodyOnLoadFunctionNames.push(""_initFormActionAjax"");

                     function _initFormActionAjax()

                     {

                       if (_spEscapedFormAction == document.forms[0].action)

                       {

                         document.forms[0]._initialAction =

                         document.forms[0].action;

                       }

                     }

                     var RestoreToOriginalFormActionCore =

                       RestoreToOriginalFormAction;

                     RestoreToOriginalFormAction = function()

                     {

                       if (_spOriginalFormAction != null)

                       {

                         RestoreToOriginalFormActionCore();

                         document.forms[0]._initialAction =

                         document.forms[0].action;

                       }

                     }";

                    ScriptManager.RegisterStartupScript(this, typeof(Rotator), "UpdatePanelFixup", fixupScript, true);

                }

            }

     

     

      protected override void CreateChildControls()

            {

                try

                {

                    if (BrowserDesignMode)

                    {

                      //nothing

                    }

                    else

                    {

     

                        base.CreateChildControls();

                        this.EnsureUpdatePanelFixups();

                        UCRotator = (UC_Rotator)this.Page.LoadControl(@"~/_CONTROLTEMPLATES/Smithsonian Controls/UC_Rotator.ascx");

                        UCRotator.ID = "UCRotator";

                        UCRotator.Rheight = this.Rheight;

                        UCRotator.Rwidth = this.Rwidth;

                        UCRotator.Itemheight = this.Itemheight;

                        UCRotator.Itemwidth = this.Itemwidth;

                        UCRotator.Home = this.Home;

                        this.Controls.Add(UCRotator);

                        ViewState["demo"] = "true";

                        //base.CreateChildControls();

                    }

                }

                catch (Exception oEx)

                {

                    throw oEx;

                }

                finally

                {

     

                }

            }

  6. divya sahu
    divya sahu avatar
    16 posts
    Member since:
    Oct 2009

    Posted 11 Jan 2010 Link to this post

    Hello ,
           I am using RadRotator in Moss 2007 site.It is working only in IE browser, It is not working in FF,crome3.0 and safari 4.0.
           I am using Telerik 2009.3.1208.20 version of dlls.
Back to Top